### Random Post

### Recent Posts

- Enigma 427: Settle some new scores
- Puzzle 59: Cricket
- Enigma 426: Time and again
- Enigma 1084: 1-2-3 triangles
- Tantalizer 466: Diplomacy
- Tantalizer 467: Nine men went to mow
- Enigma 1085: Cut and run
- Enigma 425: Them thar’ Hills
- Puzzle 60: Uncle Bungle gets the last line wrong
- Enigma 1086: Stacking trays

### Recent Comments

Jim Randell on Enigma 427: Settle some new… | |

Jim Randell on Enigma 427: Settle some new… | |

geoffrounce on Enigma 1503: Division dec… | |

arthurvause on Enigma 425: Them thar’… | |

Jim Randell on Puzzle 59: Cricket |

### Archives

### Categories

- article (11)
- enigma (1,130)
- misc (2)
- project euler (2)
- puzzle (33)
- site news (43)
- tantalizer (34)
- teaser (3)

### Site Stats

- 170,314 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