From New Scientist #1928, 4th June 1994 [link]
Two warnings about the sum shown here: the first is that it is a sum in base 12 throughout; the second is that in the bottom line the first O is the letter O (since no number starts with a zero), bit the subsequent O’s may be the letter O or the digit zero and the I may be the letter I or the digit one. Elsewhere O is the letter O wherever it appears and the I in FIVE is the letter I. Each letter stands for a different digit and the same letter represents the same digit wherever it appears.
If you want to have a chance of winning the tenner prize, please send in the value (in base 12) of FIVER.
[enigma773]
Here is a solution using the [[
SubstitutedExpression
]] solver from the enigma.py library.It runs in 81ms. (The internal runtime of the generated program is 1.3ms).
Run: [ @replit ]
The answer is reported as an integer (so appears in decimal format), but we can use [[
--answer="int2base({FIVER}, 12)"
]] to have it reported as a base 12 string.Solution: FIVER = 17960 (base 12).
The completed sum (in base 12) is:
The final row being:
In decimal the sums are:
With “–reorder=0” three loops are used instead of six.
@Frits: Nice. And it brings the internal runtime down to 344µs.
also:
I have a Python only version which is even faster (but not ready for publishing, I don’t fully understand it myself!).
It also seems to be the case the R of FOUR must always be zero.
Already checking E and O without knowing N.
Here is a solution that uses the [[
SubstitutedExpression.split_sum()
]] solver, from the enigma.py library.It has an internal runtime of 69µs.
Run: [ @replit ]
@Jim, have you considered updating SubstitutedExpression.split_sum to handle special expressions?
e.g. you might remove expression ({F} + {e} = {F}) and only allow zero for “e”.
Also an optimization might be done for R and c.
Following is the generated strategy:
Here’s my brute-force version:
@Brian, I first thought you had made a typo (range(13)) but it is needed as you do permutations. However, you don’t process all ONE’s like 143 or ONE < 14.
@Brian, I got confused. It probably is a typo (13 iso 12).
Yes, it should be 12. I did the minimum processing that I found was necessary to obtain a unique result.
Fortunately, previous work enabled me to fix upper bounds of variables and work in base 10 for this solution, converting the answer to base 12.
To convert 34200 in base 10 to base 12:
Divide the number by 12 repeatedly and record the remainders.
34200 / 12 = 2850 remainder 0
2850 / 12 = 237 remainder 6
237 / 12 = 19 remainder 9
19 / 12 = 1 remainder 7
1 / 12 = 0 remainder 1
Write the remainders in reverse order to get the number in base 12.
The number 34200 in base 10 is equal to 17960 in base 12.