Sunday Times Teaser 2829 – Making a Dozen

by Andrew Skidmore

In this addition sum different letters consistently stand for different digits:

_____S E V E N
_____T H R E E
_________T W O
___——————————–
___T W E L V E
___——————————–

What is the value of LETTERS?

1. Using my alphametic sum solver AlphaSum (see here):

Under normal circumstances, alphametic solvers based on column evaluation can be expected to be a lot faster than those based on permutations unless there are a large number of columns in the sum. On this occasion, however, the sum has a useful property in that the lower two columns and the upper 2/3 columns each involve only five letters. As a result we can split the permutation into two steps in a way that makes a solution much more efficient. Here is such a solution:

The result is a permutation based solution that outperforms the column based solver by a factor of more than 3 to 1 – 17 milliseconds compared to 59 milliseconds (timed using Python profile).

2. A straightforward Alphametic. We can solve it using the SubstitutedSum() solver from the enigma.py library. This command runs in 164ms.

The values for N and O can be interchanged, but we are asked for the value of LETTERS, so the solution is unique.

The enigma.py library is available at [ https://www.magwag.plus.com/jim/enigma.html ].