Wednesday, January 04, 2006

Cryptorithm in a Store Sales Receipt

Cryptorithms are puzzles wherein one replaces the digits in an arithmetic computation with letters. The puzzle is presented with the letters, and the object is to find out what the digits were. A famous example is (ignore the dot)


. S E N D
+ M O R E
_________
M O N E Y


Don't read too much below if you want to solve the problem yourself. In this case, the M sticks out as an additional digit on the front end of the sum, so it has to be 1. S + M = O then becomes S + 1 = O. The possibilities are 9 + 1 = 0 and 8 + 1 = 0, because 9 + 1 = 1 is eliminated becayse that would make both M and O equal to 1. Therefore, O is 0. O is often confused with zero, as in calling this year Oh-Six. Usually, O is not 0. But this case is an exception. We were told that O is some digit, and we wound up proving that it is 0.

This reduces the problem to:


. S E N D
+ 1 0 R E
_________
1 0 N E Y


If S were 8, then a carryover would have to had to occur in E + 0 = N. This implies that E would have to be 9 and N would have to be 0; however, we have already assigned O to 0. Therefore, S is 9:


. 9 E N D
+ 1 0 R E
_________
1 0 N E Y


The sum now says EN + 0R = NE. So adding 0R to EN reverses EN's digits. When you reverse the digits of a number and subtract from the number, the result is always a multiple of 9. So with no carryover, 0R has to be a multiple of 9. If there is a carryover, 0R has to be 1 less than a multiple of 9. With zero as the first digit, that means that R has to be 8 or 9. 9 is already taken, so R = 8, and N = E + 1. The digits that are left are 234567. We can choose EN to be any two consecutive digits from this. But then two of the remaining digits have to differ by 10 minus the lesser of these digits, because of D + E = Y, which carries over. So if we select 23, two of 4567 have to differ by 8, which they don't. with 34, two of 2567 differ by 7; they don't. With 45, two of 2367 differ by 6; they don't. With 6 and 7, two of 2345 differ by 4. They don't. With 56, two of 2347 differ by 5; 7 and 2 differ by 5. So D = 7, Y = 2, E = 5, N = 6, and the solution is:


. 9 5 6 7
+ 1 0 8 5
_________
1 0 6 5 2


So that is what a cryptorithm, and this shows how you can solve one. SEND MORE MONEY is a moderately difficult cryptorithm. I expect cryptorithms, as interesting puzzles, to appear in puzzle books, newspapers, and recreational mathematics books. But take a look at what I found on a store receipt the other day!

What kind of a receipt is this? It says the Megan doll costs TOO. Well, yeah, things do cost too much nowadays. But then it gives as the subtotal QQOI. Whaaa?? Then I realized that the entire thing is a cryptorithm! Why would JC Penney put a cryptorithm on their sales receipts? Maybe they want their customers to solve puzzles. But I am game for this one. The complete cryptorithm is:


Megan Doll...TOO
Plush Dolls..TOO
Subtotal....QQOI
Sales Tax.....YP
TOTAL.......QWTI


I thought maybe O was a misprint or was intended to be a zero. It can't be, as 0 + 0 = 0, not I, whatever I is. For the same reason as before, Q must be 1. This means the double of a digit is 11. The only possibility is 5 with a carry, 5 + 5 = 11. So O + O must be O, with a carry. The only digit which has this property is 9: 9 + 9 = 19. So O is 9, and both dolls cost $5.99. This means that the Subtotal is $11.98, making I = 8. Now here at this point I used the fact that Virginia sales tax is 5%. This gives either 59 or 60 for YP. Since 9 has been used, YP must be 60. The total of QWTI then must be $12.58. Sure enough, this amount matched a figure on my check account statement.

So there it is. A cryptorithm on a sales receipt solved. Where else can we get mathematical puzzles? Suppose 9 players play 9 different other players in some 1-1 game, such as chess or racquetball. Suppose each of 9 weeks, each player must play a different player from the other team, and suppose there are three places for the games, and that every three weeks, the players rotate places. Suppose someone has half scheduled this tournament. The scheduling the remaining players is a Sudoku puzzle!

Or how about having Rubik's Cubes show up as airline schedules? Airline scheduling is harder than solving that infamous cube. There are many ways in which services and manufacturers could confront customers with puzzles.

In this case, I noticed some words. "Gift Receipt". Does a cryptorithm come with each gift? Maybe the idea was to hide the price, since most givers don't like to disclose the price to receivers. But look what happens when you substitute the numbers for the letters in the JC Penny cryptorithm:


0 1 2 3 4 5 6 7 8 9
P Q W . . T Y . I O


What does that say? Qwerty, that's what. The first line of characters on the typewriter keyboard. But P following O on the keyboard means that the 0 must follow the 9:


1 2 3 4 5 6 7 8 9 0
Q W E R T Y U I O P


But someone could have typed in these prices simply by typing the real prices with your hands off the home keys. What a code that is! It's easily cracked. But not everyone is going to solve cryptorithms or type prices in the computer with the hands misplaced. So I guess this code is safe.

Interesting. Penney's receipt cryptarithms. What will they think of next?