, , , ,

Enigma 1407My daughter’s partner, Dale, recently e-mailed me “a summer teaser” to keep me occupied while my wife and I were looking after his two young daughters—our granddaughters—for a couple of weeks.  As if I needed a distraction!  Anyway, I took a look at the teaser.  Basically, the problem is to find an assignment of the ten positive digits {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} to the ten alphabetic characters {S, A, N, D, U, E, X, I, B, Z} in the SAND + SUN + SEX + SEA = IBIZA summation above such that each letter is represented uniquely from the set of digits and the summation is correct.  These types of puzzles, often called alphametic, cryptarithm or letter/number puzzles, are common and are either solved by an exhaustive enumeration of all possible solutions (an evaluation of every permutation of the numbers-to-letters assignments) or by treating the alphabetic characters as symbols in a set of algebraic equations that may be solved simultaneously with the help of logical deductions and subset permutations.  For example, the simple alphametic I + BB = ILL is solved as follows:

IBBILL-0From Col. 1:  I + B = C1L (Eqn. 1) where C1 is the carry-over, if any, into Col. 2 from the I + B addition.

From Col. 2:  B + C1 = C2L (Eqn. 2) where C2 is the carry-over, if any, into Col. 3 from the B + C1 addition.

From Col. 3:  I = C2 (Eqn. 3)

We have three equations and five unknowns so cannot solve using classical algebra but we can immediately deduce that both C1 and C2 are equal to 1 simply because in any column with only two single-digit entries to be summed, it is impossible for the sum to be greater than 18 (= 9 + 9) i.e. a carry-over of 1.  Thus, C1 = 1 (else B would be the same as L in Col. 2) and C2 = 1 (else I would equal 0 in the result line and a number starting with 0 makes no sense).   Thus I = 1 from Eqn. 3.

IBBILL-1In Eqn. 1 substituting for I and C1, 1 + B = 1L.  The only single digit value that fits B in order to generate a carry-over of 1 is B = 9.  Thus L = 0 and we have the solution:IBBILL-2

BazingaOkay, that was easy.  Now what about the SAND + … puzzle.  I solved it.  It was a slog involving lots of back-of-envelope permutations looking for consistent assignments to fit the various column addition constraints and when I’d finished I looked for solutions on the Web.  I found only one solution based on a computer program that evaluated every possible assignment of the ten single digits to the ten alphabetic characters—a brute force solution.  If you think about it, there are ten ways of assigning a digit to the first character S, followed by nine ways of assigning the second character A, followed by eight ways of assigning the third character N, followed by …  In other words, the total number of permutations is given by 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 3,628,800.  The website that listed the solution referred to this particular alphametic problem as Enigma 1407 and included the source code for the exhaustive evaluation computer program written in a language called Python.

Here is my solution.  It does match the computer-program-generated solution (phew!) and does require some logical deductions and subset permutations but the problem is soluble “by hand” on the back of a few empty envelopes.  If you are interested to know how I solved the Enigma 1407 puzzle send me an e-mail and I’ll reply with my solution, no strings attached.

1407 Solution

If you enjoy solving letter/number puzzles, try this one: BLOGS + FROM + BEN = BOGGLE.  I don’t know if there is a solution—I’ve just made it up—but I’m thinking I’ll take a break from grandfatherly duties and go to Ibiza to figure it out.  Ibiza seems like a fun place to be.

Off to IbizaThen again, my granddaughters are fun to be with and I suspect I’m too old to partake of all that Ibiza has to offer.  Plus, my wife will probably not agree to me taking an Ibizan sojourn!