### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,149)
- misc (2)
- project euler (2)
- puzzle (38)
- site news (44)
- tantalizer (40)
- teaser (3)

### Site Stats

- 175,242 hits

Advertisements

Programming Enigma Puzzles

12 January 2018

Posted by on **From New Scientist #1581, 8th October 1987** [link]

In the addition sum below, letters have been substituted for digits. It was Uncle Bungle’s intention, when he made this sum up, that the same letter should stand for the same digit wherever it appeared, and that different letters should stand for different digits. Unfortunately, however, he made a mistake, and

oneof the letters is incorrect.Write out the correct sum with digits substituted for letters.

[enigma431]

Advertisements

%d bloggers like this:

We’ve solved many puzzles in a similar vein to this one before. (See:

Enigma 405,Enigma 284,Enigma 197,Enigma 29,Puzzle 76).Here I’ve adapted my

MiniZincsolution toEnigma 197to solve this problem. This program uses theminizinc.pywrapper library. With the [[mzn-g12fd -a]] solver it runs in 442 ms.Solution:The correct numerical sum is: 944277 + 9148467 = 10092744.The corresponding alphametic sum is: PHHYBB + PLHXHAB = LRRPYBHH.

The incorrect letter is the units digit of the result. It is given as P, when it should be H.

Another approach is to use the

SubstitutedSum()solver from theenigma.pylibrary.Here is a general solver for this type of problem. This program runs in 773 ms.

Run:[ @repl.it ]