My 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:

From Col. 1: I + B = C_{1}L (Eqn. 1) where C_{1} is the carry-over, if any, into Col. 2 from the I + B addition.

From Col. 2: B + C_{1} = C_{2}L (Eqn. 2) where C_{2} is the carry-over, if any, into Col. 3 from the B + C_{1} addition.

From Col. 3: I = C_{2} (Eqn. 3)

We have three equations and five unknowns so cannot solve using classical algebra but we can immediately deduce that both C_{1} and C_{2} 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, C_{1} = 1 (else B would be the same as L in Col. 2) and C_{2} = 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.

In Eqn. 1 substituting for I and C_{1}, 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:

Okay, 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.

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.

Then 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!

(^_^)

Tony

said:You’re bored…

LikeLike

Mozz

said:Indeed – very bored!

I’d rather do the ironing and I HATE ironing!!

Mozz

LikeLike

Jim Randell

said:Thanks for linking to

Enigmatic Code – Enigma 1407: Fun in the sun.The

Enigmatic Codesite aims to collect a complete archive ofEnigmapuzzles that were published inNew Scientistmagazine between 1979 and 2013, along with solutions to them all. I try to provide a programatic solution where I can, but some of them I have only solved manually. Currently there are almost 1000 puzzles on the site.The SubstitutedSum() solver I used to solve

Enigma 1407considers the columns of an Alphametic addition sum working from right to left, so it runs quite a lot faster than just considering all possible letter to digit assignments. The right-to-left strategy makes it easier to handle the carries, but isn’t necessarily the most efficient strategy. For example, when solving this puzzle by hand I found it better to start with the carry into the final column and that quite quickly gets you to the solution.I can tell you that “BLOGS + FROM + BEN = BOGGLE” has no solutions as a standard Alphametic sum in base 10. However we can consistently assign the letters to the digits 0 or 1 to get a sum that works in binary (of course we have to drop the requirement that different letters stand for different digits). There are 4 solutions, if we disallow leading zeros.

If you are interested in the Python code for the SubstitutedSum() solver, I posted the original version as a solution to

Enigma 63[ https://enigmaticcode.wordpress.com/2013/01/08/enigma-63-addition-letters-for-digits/ ], but the latest version is always available in theenigma.pylibrary [ http://www.magwag.plus.com/jim/enigma.html ].I also wrote a Python solver that can consider general Alphametic expressions, not just addition sums (available as SubstitutedExpression() in the

enigma.pylibrary). That does essentially try all possible letter to digit assignments, but if multiple expressions are given it uses a heuristic to start with the with the expressions that use the fewest letters, and that means we don’t usually have to explore the entire solution space. More information on this general solver is available at [ https://enigmaticcode.wordpress.com/2016/06/29/solving-alphametics-with-python-part-2/ ].LikeLike

Ben Bennetts

said:Thanks for your comments, Jim. Thanks also for the offer for your programmed solution but I’ve no familiarity with the Python language. The last computer programming I did was in the early ’70s using FORTRAN on a clunky ICL mainframe computer.

My hand-generated solution to the Enigma 1407 alphametic was, indeed, to start at the most-significant end with the easily induced fact that I = 1 and then work a pincer movement from both ends to solve the letters in the middle column. It was an interesting mental and logical problem and kept me off street corners for a while.

My BLOGS + FROM + BEN = BOOGLE was me flying a kite. There are ten letters with one final carryover so there might have been a solution starting with B = 1 but not so. Ah well. Thanks for searching however.

Ben

LikeLike