### Random Post

### Recent Posts

- Tantalizer 478: Surprises
- Enigma 1109: All square in games
- Enigma 402: A DIY puzzle
- Puzzle 71: All wrong, all wrong
- Enigma 1110: Dots and lines
- Enigma 400: Potential difficulties
- Tantalizer 479: Cat and five tales
- Enigma 1111: Base-age
- Enigma 399: Time, gentlemen, please
- Tantalizer 480: Pitter patter

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,080)
- misc (2)
- project euler (2)
- puzzle (21)
- site news (42)
- tantalizer (22)
- teaser (3)

### Site Stats

- 157,227 hits

You can use the

SubstitutedSum()solver from theenigma.pylibrary:or the general

SubstitutedExpression()solver:although neither is particularly quick (799ms for

SubstitutedSum(), 1.17s forSubstitutedExpression()).Solution:NIL = 617.When the solution was originally published in

New Scientist#2301 a solution of NIL = 61 was given. A correction to this was published inNew Scientist#2304 giving the correct answer.With a bit more work we can reduce the run-time for the

SubstitutedExpression()solver to a more reasonable 110ms by splitting out the columns as individual sums and including additional symbols (abcde) for the carries (which have a limited set of values). This gives the heuristic algorithm a chance to decide the order in which to consider the columns (instead of the simple right-to-left evaluation done by theSubstitutedSum()solver).If we wanted to, we could specify expressions in the order we wanted them to be evaluated in, and then pass the “

--reorder=0” flag as a solver parameter to tell the solver to consider them in the order specified.The lion’s share of the 110ms spent by the

SubstitutedExpression()solver is in the creation and compilation of the specialised Python program to solve the problem. The actual internal runtime of the specialised program (after compilation) is only 9ms.Here is the appropriate run file:

http://www.iread.it/cryptarithms.php

NIL+TWO+SEVEN+ELEVEN=TWENTY

Solution:

L O N Y I T W S E V

7 4 6 3 1 9 0 2 8 5