# Algorithm (cryptarithm) question, yes it is homework, but I can't get it

The following is a multiplication problem in traditional base ten notation. Each letter represents a different digit. What digit does each letter represent? How did you get your foot in the door?

-
could x and y both be 0 –  NEWprogrammer Dec 3 '10 at 0:03
what is the fraction in the fourth line for? –  Timothy Wagner Dec 3 '10 at 0:05
i posted the way it looks in the book –  NEWprogrammer Dec 3 '10 at 0:09
OK, it wasn't clear from the way you wrote it. –  Timothy Wagner Dec 3 '10 at 0:16

For the first equation $X=1,Y=0$ works.

This should be the only solution since, $XY\cdot YX= XY$ implies $XY=0$ or if $XY\neq 0$ then, $YX=1$. If $XY=0$ then $X=Y=0$ (remember $X,Y$ are digits here), so they are not distinct.

For the second part, $Y=0$, so the only way to get a third digit in the final solution, would be to have $X+Z=1+Z$ be a two digit sum. This can only happen if $Z=9$, so $V=0$ and $W=1$

-
that would give be 10*01=10, so that works –  NEWprogrammer Dec 3 '10 at 0:04
how in the world did you even figure this out –  NEWprogrammer Dec 3 '10 at 0:17
try a few and you'll learn all the tricks. –  Yuval Filmus Dec 3 '10 at 5:14

The image changes the problem and turns this into a classic 'long multiplication' cryptarithm problem. For starters, we know (for the same reasons given above) that X=1, because multiplying X by XY gives XY again. The second line tells us that Y*XY = YZ; in particular, since Y*X = Y, we know that Y*Y can't introduce a 'carry' digit to pollute the 1-by-2 multiplication. This means that Y is either 2 or 3, leaving Z to be either 4 or 9 respectively (i.e., '2*12 = 24' or '3*13 = 39' - notice how 4*14 = 56, and the carry digit I mentioned before turns the tens digit into a 5, one more than the Y that it needs to be). From here it's just trial and error, performing the rest of the calculation and checking to see whether either one gives duplicate digits. For XY=12, we get XY*YX = 12*21 = 252 - but notice that this would be written as 'YVY', since we're told that each letter corresponds to a unique digit; we couldn't have W and Y both be 2. However, with XY=13, we get XY*YX = 13*31 = 403, so ultimately we get the solution: X=1, Y=3, Z=9, W=4, V=0.

(ETA: The multiplication can be confusing if you haven't seen it before - this is the old-style 'long multiplication' way of doing products, which I seem to recall isn't taught as much any more. Each line between the two horizontal rules corresponds to the result of multiplying one of the lower digits by the entire upper number, and then those lines are all added together to produce the sum beneath the lower horizontal rule.)

-