Enigmatic Code

Programming Enigma Puzzles

Enigma 1272: Jonny Wilkinson

From New Scientist #2430, 17th January 2004

You may have noticed that England won the Rugby Union World Cup.

In this sum to celebrate the hero (or for the Aussie readers the villain) of the hour, the digits 0 to 8 are consistently represented by capital letters, different letters being used for different digits.

No number starts with a zero, and 9 should not be used.

JONNY = WILKI + NSON

Find the 5-digit number represented by JONNY.

[enigma1272]

2 responses to “Enigma 1272: Jonny Wilkinson

  1. Jim Randell 9 December 2014 at 8:10 am

    The [[ SubstitutedSum() ]] solver from the enigma.py library can be used to solve this. I added a [[ go() ]] method to the solver that outputs all solutions (that pass an optional filter), which lets you solve problems like this with a one-liner.

    The following Python program runs in 54ms.

    from enigma import irange, SubstitutedSum
    
    SubstitutedSum(['WILKI', 'NSON'], 'JONNY', digits=irange(0, 8)).go()
    

    Solution: JONNY = 52331.

    There are two corresponding sums:

    52331 = 48608 + 3723
    52331 = 48708 + 3623

    L and S are 6 and 7, but it doesn’t matter which way round.

  2. Naim Uygun 9 December 2014 at 12:46 pm
    """
    Output:
    JONNY = 52331  WILKI= 48708  NSON= 3623
    JONNY = 52331  WILKI= 48608  NSON= 3723
    """
    from itertools import permutations
    for p in permutations("876543210",9):
        #if '0' in [j,w,n] : continue
        w,i,l,k,n,s,o,j,y=p
        wilki=w+i+l+k+i
        nson=n+s+o+n
        jonny=j+o+n+n+y
        if int(jonny) != int(wilki)+int(nson): continue
        print("JONNY =",jonny, " WILKI=",wilki, " NSON=",nson)
    

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.