From New Scientist #2829, 10th September 2011 [link] [link]
Recently retired cricket all-rounder Andrew Flintoff was known as Freddie until a much-publicised incident with a pedalo gave rise to the new nickname Fredalo. In the sum shown, digits have been replaced by letters, different letters representing different digits. Since there are 11 different letters everything is in base 11. Use 0 to 9 as normal and X for the extra digit.
What is the eight-digit number (still in base 11) represented by FLINTOFF?
[enigma1663]
This can be done in a much shorter program without the early rejection, and all the tedious mucking around with base 11 carries, but it’s 1000× slower.
The following Python code has a runtime of 33ms.
Solution: FLINTOFF = 68042966 (base 11).
Here’s the shorter program, with no early rejection – it takes 3m36s to run (26s in PyPy).
The following Python program uses the [[
SubstitutedSum()
]] solver from the enigma.py library. It runs in 52ms.