Send More Money

October 19th, 2005 admin

My father asked me this question over the phone this weekend.

“A college going kid’s father, tired of his sons repeated requests for money throws him a challenge. He asks the son to solve a math puzzle, before expecting any more money from the dad. SEND + MORE = MONEY is a mathematical equality, where each letter is a unique numeral. What is the equality in numbers?”.

It turned out to be an immensely interesting puzzle. It has a unique solutions, the solution can be logically deduced, and it makes a sensible English phrase! That third point is something I am still not sure whether to be amazed by or not.

Here is a sequence of steps I followed in my deduction of the solution

  S E N D
+ M O R E
---------
M O N E Y

The M has to be a 1, since the carry from adding S of SEND and M of MORE can be either a 0 or a 1, and in this case it is a 1 since we have M in MONEY to represent it. Another way to say the same thing is adding two numbers in the thousands can not give you twenty thousand or more. even 9999 + 9999 falls short of 20000 by 2.

  S E N D
+ 1 O R E
---------
1 O N E Y

S in SEND and 1 from 1ORE have to add to result in a carry since the whole existance of the 1 in 1ONEY depends on it. That is possible only if S is 9, there is no carry from the hundreds’ place (and therefore the O in MONEY is 0) or S is 8 and there is a carry of 1 from the hundreds’ place (in which case the O in MONEY is 0 again) or indeed the case that S is 9, and there is a carry of 1 from the hundreds’ place (and here the O in MONEY is 1). Since O can’t be 1, as M has wrested that privilege, the only two plausible choice is that S in SEND is 8 with a carry from the hundreds’ place or the S is 9 with no carry from the hundreds’ place. So, are we stuck? Which of these two to choose? Well, time to look a little into the future, by which I mean the hundreds place. One thing is certain, whether S is 9 with no carry or 8 with carry, the O in MONEY is 0. Therefore the O in MORE is 0 too! So looking at the hundreds’ place, E + 0 = N. That can’t be. There must be a carry from the tens’ place! So the hundreds’ place equation now reads, 1 + E + 0 = N. The question we are after is does 1+E give rise to a carry or not. Only way it can give rise to a carry is if E = 9. But then 1+E =10 and that means N = 0. That can’t be. O has gotten that privilege. So we do not know what E is but is certainly is not 9 (and not 0 or 1). So that means, since there is no carry over from the hundreds place S is 9.

  0 1
  9 E N D
+ 1 0 R E
---------
1 0 N E Y

N is one more than E. At first glance the values E can take are 2,3,4,5,6,7,8. Of these, 8 has to be ignored since then N would be 9. But 9 has already been assigned to another letter. Still the choices for E are too many. Looking at the tens’ place, N + R = E + 10 or 1 + N + R = E + 10 (if there is a carry from the ones’ place). The 10 in the above equation comes in because there is a carry from the tens’ to the hundres’ place for sure. Substituting E+1 for N, we get either E + 1 + R = E + 10, which implies R = 9 which is not possible, or that, 1 + E + 1 + R = E + 10, which leaves us with the information that R = 8 and equally importantly, that there is a carry from the ones’ to the tens’ place.

  0 1 1
  9 E N D
+ 1 0 8 E
---------
1 0 N E Y

Now we look at the ones’ place. D, E and Y have to be three amongst 2,3,4,5,6,7 since the others have been taken. The information that the ones’ place lends a carry to the tens’ place means D + E = Y + 10. Note than the ones’ place cannot have a carry from the tenths’ place. This implies that D and E have to add up to at least 12, since Y is, at a minimum, 2. The only ways of adding a pair from the remaining numbers to get 12 or more are 5+7 or 6+7. E is either 5,6 or 7. Now we fall back upon the hundreds’ place to bail us out of the dilemma. The hundreds’ place tells us that E + 1 = N. Therefore E cannot be 7, since then N would be 8. N cannot be 8 since 8 is taken by R. Since E cannot be 7, E is either 5 or 6. Either way, D is 7. Now, if E were 6, N, which is E + 1, would be 7. That is not possible since we just allocated 7 to D. So E is 5 and N is 6.

  0 1 1
  9 5 6 7
+ 1 0 8 5
---------
1 0 6 5 Y

Y is therefore 2. And the final solution is 9567 + 1085 = 10652

Posted in Tidbits | No Comments »

PseudoLRU Replacement Scheme

October 10th, 2005 admin

I am taking ECE521, a Computer Architecture course at NCSU and am thoroughly enjoying it. One of the topics that was touched upon in the class, and with which I later struggled for a few hours was how pseudoLRU replacement policy works . I could not find useful tutorials on the net and decided to write one for myself. Feel free to use it as is if you find it helpful, or let me know and I can send you the ppt version.

Posted in Tutorials | No Comments »