Aug 31, 2012

Send More Money: an unnecessarily detailed solution

In Korean, the word for alphametics literally means “masked arithmetics” (복면산, 覆面算). This enthralled me as a kid. Just like we all were, I was fascinated by anything that had to do with codes and secrets, and solving alphametic puzzles kept busy the Holmes inside me.

A “good” alphametic problem, in my opinion, must meet two criteria. First, the sequence of letters must form a sentence or a phrase that makes sense and is unique. For instance, EVE / DID = .TALKTALK… meets this standard. QEJE + MIWK = QOKDN does not. Second, the solution must involve a logical process. The ones that can only be solved by plugging in random numbers until you get the answer, or at least a certain pattern, are not what I consider good alphametic puzzles. Here I introduce a classic puzzle that meets both of these standards. It is probably also one of the easiest and most well-known.


This puzzle was first introduced by Henry Ernest Dudeney in Strand Magazine (We can only imagine how desperate he was). The rules are simple. You substitute each letter for a digit so that the equation is true. Different letters cannot be substituted for the same digit, and the same letter cannot be used to indicate more than one digit. The first digit can never be zero.

So let me explain how easy this puzzle is.


Step 1 

The first thing you should notice is that M is 1. This is because adding two greatest possible digits yields 18 (9 plus 9), and even if a digit is carried over, the answer is still 19 and can never exceed 19. Likewise, adding two two-digit numbers cannot yield a number that exceeds 199 (99 + 99 = 198). If the result has more digits than either of the values on the left side of the equation, the first digit of the result is always 1. So erase M, write 1 in its place, and now we have:


Step 2

The most logical next step would be to solve for O. Take a look at the highlighted portion of the equation below.


Note that O cannot be 1, since we already know that M is 1. Even if S were 9, which is the greatest possible value it can hold, O would be either 0 or 1. But since it cannot be 1, it would have to be 0.  

 

Step 3

We’re still dealing with the highlighted portion. So what is S? We know that it cannot be anything less than 8, because then we wouldn’t get a five-digit answer. This means that S is either 8 or 9. Let’s consider both possibilities.

Option 1: S = 8?


We can see that something must have been carried over, because somehow we ended up with 8 + 1 = 10. So E has to be 9 in this case. If it were 8 (which it cannot be anyways—we hypothesized that S is 8), N would be 9, and the carry-over would not take place. Plug in E = 9 and we have:


But in this case N would have to be 0, which is impossible because O is 0. So this option fails and we’re left with S = 9.

Option 2: S = 9.


We are facing an interesting situation here. Something plus zero is something else. This can only mean one thing—carry. Remember that in additions, the maximum value that can be carried over is 1. Thus, N = E + 1.

Now focus on this portion:


Remember that N is greater than E by 1. This is the key to solving for R. Since the title of this post promises an “unnecessarily” detailed solution, let’s think about it this way. Suppose N = 3 and E = 2. From the highlighted portion above, we can see that R has to be either 9 (for obvious reasons) or 8 (if 1 was carried over). But since 9 has already been assigned to S, the only digit left for R is 8. Try it with any other N-E pair—you will get the same result. 


Step 4
We are almost there. Now may be a good time to pause and list the digits that are still available to us. 0, 1, 8, and 9 are already taken, so we are left with 2, 3, 4, 5, 6, and 7. Which ones of these could E and N be?

First of all, E cannot be 7, because then N would have to be 8 (N = E + 1) and we know that 8 is not one of the digits available. To see what else we can cross out, consider the highlighted portion below.


We know that D + E must exceed 9, because something has to be carried over from this stage. The highest possible value for D is 7 (8 and 9 are already taken). This means that E cannot be 2—nothing would be carried over. Let’s consider two more possibilities.

If E = 3…

Then D cannot be 7, because that would mean Y = 0, which is impossible (0 is already taken). D also cannot be anything from 1 to 6 for the same reason E cannot be 2—no carry-over takes place. So If E were 3, no value could possibly be assigned to D. This only means that E is not 3.

If E = 4…

D cannot be 7 or 6, because that would mean Y = 1 and Y = 0, respectively, and 1 and 0 are already taken. D cannot be 5 or less—no carry. So E = 4 is out as well.

As we have eliminated most of the possibilities, we are only left with the following two pairs:

E = 6 and N = 7, and
E = 5 and N = 6.

We find out which pair is the correct one in Step 5.


Step 5

We have two hypotheses. Hypothesis 1: E = 6 and N = 7. Hypothesis 2: E = 5 and N = 6.

Hypothesis 1: E = 6, N = 7.


The same old procedure we have gone through in Step 4 is all it takes to see why this hypothesis is invalid. If E is 6, what can D be? Definitely not 0 or 1 (already taken) and also not 2 or 3 (no carry). D is not 4 (Y would be 0), or 5 (Y would be 1), or 6 (taken by E), or 7 (taken by N), or 8 (taken by R), or 9 (taken by S). Since nothing is available for poor D, this hypothesis fails and we are left with E = 5 and N = 6.

Hypothesis 2: E = 5, N = 6 (the correct one).


We are approaching the end. Two more letters to go! We need to pick the digits for D and Y from the four remaining ones: 2, 3, 4, and 7. D cannot be 2 or 3 or 4—no carry. The only possible choice is D = 7 and Y = 2, and this completes the solution.

Ta-da!

Now that I have almost finished writing a 1400-word post, it’s time for me to watch the Masked Magician infuriate his fellow magicians by revealing magic’s biggest secrets, and time for you all to solve the next alphametic problem. It is the most aesthetically pleasing one I’ve encountered, but to be honest I still haven’t reached the answer. I hope this is not one of those puzzles that you can only solve by plugging in a bunch of random numbers—its beauty deserves a clean, logical solution. If anyone has a clue, please enlighten me.

The rules are the same, except the asterisks can be any digit and they do not have to be the same digit.


No comments:

Post a Comment