Who is asking: Teacher
Level of the question: Secondary

Question: Students brought this website to my attention and asked why this puzzle worked... I'm not sure. The url is: http://digicc.com/fido/ and it tells you to choose a 3 or 4 digit random number with different digits. Write it down, rearrange, subtract the smaller from the larger. then circle a nonzero digit, type the remaining digits into the space provided and they will tell you the number you circled. Can you provide the reason that this works.
Thank you


This is a nice trick; perhaps you could suggest that they add a link to a page explaining how they do it. It is fun to mystify, but much more rewarding to teach people the nice structural properties of numbers.

"How they do it" is easy to explain, "why it works" is a bit harder. If I take for instance 1963 and shift the digits to get 6139, I do 6139 - 1963 = 4176. I can for instance circle the 7 and write down 416. The machine will then add up the digits I wrote down (4+1+6 = 11) add up the digits in this answer (1 + 1 = 2) and repeat the process
until it gets a single digit (here 2). If this single digit is 9 then my circled digit is also 9, and otherwise my circled digit is 9 - this single digit (here 9 - 2 = 7). It would work the same way if I typed in a 5-digit, 6-digit or larger number.

The reason why it works is related to "casting out nines": When you take a number N add up its digits and repeat the process until you get a single digit, this single digit is the remainder of division of N by 9 (or 9 if N is a multiple of 9). The reason why this is true is exemplified in
(and also in french in
So, when you rearrange the digits in N to get a new number N', the sum of the digits in N' is the same as that in N, so the remainder of division of N' by 9 is the same as the remainder of division of N by 9.

Now here is the trick: When you subtract the smaller from the larger (say N' - N), the answer you get is a multiple of 9. The machine knows this, hence when you circle a digit and feed in the remaining numbers all it needs to answer is "What number from 1 to 9 do I need to add to the sum of these digits to get a multiple of 9?"


If your students like mathematical puzzles they could try this one.