### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,314)
- misc (3)
- project euler (2)
- puzzle (78)
- puzzle# (21)
- site news (54)
- tantalizer (80)
- teaser (7)

### Site Stats

- 217,164 hits

Programming Enigma Puzzles

8 April 2019

Posted by on **From New Scientist #1646, 7th January 1989** [link]

In the following long division sum I’ve marked the position of each digit. I can tell you that there were no 1s and no 0s but that all other digits occurred at least twice. Also (although you don’t actually need this information) all four digits of the answer were different.

What is the six-figure dividend?

[enigma494]

%d bloggers like this:

We can use the [[

SubstitutedDivision()]] solver from theenigma.pylibrary to solve this puzzle.We can use the [[

--extra]] parameter to include the additional check that all digits between 2 and 9 occur at least twice in the completed sum.This run file executes in 134ms.

Run:[ @repl.it ]Solution:The dividend is 253536.The full sum is: 253536 ÷ 32 = 7923.

I have been playing with Jim’s excellent minizinc.py wrapper for the MiniZinc constraint solver so this seemed like a nice puzzle to try it out.

I think that because there are some symbols that appear more than once in the sum the code that count their occurrences needs a minor adjustment. (Although it doesn’t change the answer that is found – you can change the string of symbols to check to a 29 character string).

But as you construct the original sum to output the solution you could move the check into the Python code, and have a simpler

MiniZincmodel (although this requires MiniZinc to be returning all solutions (which is the default behaviour)).A standard MiniZinc solution.