### Random Post

### Recent Posts

- Enigma 1096: Prime break
- Enigma 415: Buses galore
- Puzzle 65: Division: figures all wrong
- Enigma 1097: Chessboard triangles
- Enigma 414: Nicely bungled, Sir!
- Tantalizer 473: Pigeon post
- Enigma 1098: Soccer heroes
- Enigma 413: Quargerly dues
- Puzzle 66: Hopes and successes on the island
- Enigma 1099: Unconnected cubes

### Recent Comments

geoffrounce on Enigma 1096: Prime break | |

Brian Gladman on Enigma 1096: Prime break | |

Hugh Casement on Enigma 1096: Prime break | |

Jim Randell on Enigma 1096: Prime break | |

Jim Randell on Enigma 415: Buses galore |

### Archives

### Categories

- article (11)
- enigma (1,107)
- misc (2)
- project euler (2)
- puzzle (27)
- site news (43)
- tantalizer (27)
- teaser (3)

### Site Stats

- 164,476 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