### Random Post

### Recent Posts

- 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
- Enigma 412: A triangular square

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 164,322 hits

We can use the

SubstitutedDivision()solver from theenigma.pylibrary to solve this in 436ms.However, we can get a faster solution (although with more typing) by using the

SubstitutedExpression()solver.This run file translates the lower case letters in the original sum to upper case and adds additional upper case letters for the dashes. The complete run time is 147ms.

Solution:The correct sum is 305283 ÷ 33 = 9251.Even without the additional condition that all the digits in the result are different there is only one solution.

I used lowercase versions of the letters you used in my solution and got the same answer

ie 9251 X 33 = 305283 in 84 msec.

The programme was a bit long in MiniZinc, but I wanted to try a division alphametic in MiniZinc

I used ‘FG’ (lowercase) in the multiplications (as your statement of the puzzle) but noticed you say ‘EF’ in the solver for the divisor? Anyway, I get the same answer.

@geoff: Thanks for pointing out the EF / FG mix-up. I renamed some of the symbols I used before posting my code, but I must have missed changing them in the multiples. Fortunately it turns out that E, F and G all stand for 3, so it didn’t affect the result of the program, but I’ve sorted it out now.

I’d been considering writing code to automatically turn these problems into expressions that can be fed directly into the

SubstitutedExpression()solver without manual intervention. So maybe it’s time to look at that again.This puzzle has led me to make the “distinct” parameter for the

SubstitutedExpression()solver more flexible.This means we can now specify multiple sets of symbols, and the values of the symbols in each set have to be distinct from the values of the other symbols

in that set, but may be the same as the value of symbols in different sets.This removes the need for the

"is_pairwise_distinct(H, I, J, L)"expression (line 38) in my solution using theSubstitutedExpression()solver. Instead we can just specify the “distinct” parameter as--distinct="DKRT,HIJL"at line 20. The rest of the file remains the same.This functionality is available in

enigma.pyfrom version 2017-03-24.The new implementation of the

SubstitutedDivision()solver in theenigma.pylibrary is derived fromSubstitutedExpression()so we can use the same technique to require the digits of the result to be distinct, but we don’t need to specify symbols for the rest of the sum.Here’s a run-file that uses the new

SubstitutedDivision()solver. It executes in 179ms.