I follow the blog “Math Jokes 4 Mathy Folks“.  A recent post gave a game/riddle you can play with kids or even post a set of questions on some social media site and play with your friends.  The post is “Can I Get Your Digits“.

So, here are the questions you can ask:

[Step-1] Pick a number with more than four digits (keep it secret).
[Step-2] Add the digits of the number together (keep it secret).
[Step-3] Subtract this sum from the original number (keep it secret).
[Step-4] From [Step-3] give me all the digits except for one of them (keep that digit secret).
[Step-5] I will ‘magically’ guess the missing (secret) digit!

The ‘magic-guess’ is: Add up the digits given to you and then add what ever number it takes to get to the nearest multiple of nine and that number is the missing digit.

So for example: the number 87694. When the digits are added you get 34.  When you subtract 36 from 87694 you get 87660.  Below is a table for each of the possible missing digits from number 87660.

Missing the ‘0’ … 8+7+6+6 = 27 (The missing digit is ZERO)
Missing the ‘6’ … 8+7+6+0 = 21 (The missing digit is SIX)
Missing the ‘7’ … 8+6+6+0 = 20 (The missing digit is SEVEN)
Missing the ‘8’ … 7+6+6+0 = 19 (The missing digit is EIGHT)

Now here is an explanation of why this always works.

The way numbers are represented is in what is called a ‘Place Value System’.  In this system a number can be thought of as a sum of the digits of the number times a power of 10 (for a base 10 number).  The power of 10 depends on the ‘Place’ of the digit.  The ‘least-significant’ digit (the on on the right end of a number) can be thought of as that digit times $10^{0}$.  The next ‘Place’ is called the 10’s place and can be thought of as that digit times $10^{1}$, with the next ‘Place’ being the 100’s place or the digit times $10^{2}$ and so forth.

So for example:

$87694\quad =\quad 8\times {10}^{4}+7\times {10}^{3}+6\times {10}^{2}+9\times {10}^{1}+4\times {10}^{0}$

And this representation is equivalent to the following one when you replace the powers of 10 with the corresponding addition problem:

$8\left( 1+9999 \right) +7\left( 1+999 \right) +6\left( 1+99 \right) +9\left( 1+9 \right) +4$

It is now clear how this ‘magic guess’ works. When you distribute each digit over the corresponding sum you get the following:

$8+8\left( 9999 \right) +7+7\left( 999 \right) +6+6\left( 99 \right) +9+9\left( 9 \right) +4$

Regrouping you get the following very suggestive formula:

$(8+7+6+9+4)\quad +\quad 8\left( 9999 \right) +7\left( 999 \right) +6\left( 99 \right) +9\left( 9 \right)$

This is clearly the sum of the digits of the original number plus another number that is clearly a multiple of nine:

$\sum { digits\_ of(87694) } \quad +\quad 9\left[ 8\left( 1111 \right) +7\left( 111 \right) +6\left( 11 \right) +9\left( 1 \right) \right]$

The main thing to realize here is that when you subtract $\sum { digits\_ of(87694) }$ from the original number you are left with a number that (whatever its actual digits are) is a multiple of nine.

Finally it is the case that any number that is a multiple of nine also has the property that the number resulting from summing its digits is also a multiple of nine. This final fact is what you use to find the missing digit. Leaving out a single digit will ‘disturb’ the sum so it is no longer a multiple of nine and you only need sum up what you are given and find that number that causes the sum to be a multiple of nine to deduce the missing digit.

Notice: When the dropped digit is either a ‘0’ or a ‘9’ your magic ‘guess’ should be: “You left out either a 9 or a 0.”

Notice: This explanation can be extended to an arbitrary number of digits and thus it would be a proof.

Notice: That a multiple of nine also has the properties that the sum of its digits is also a multiple of nine can be explained in exactly the same way as the explanation above goes. So assume some number is a multiple of nine:

$X\quad =\quad 9x$

Now write X as a sum of its digits with each one times its corresponding power of ten:

$X\quad =\quad \sum _{ i=0 }^{ n }{ { a }_{ i } } { 10 }^{ i }$

Notice that we can write each term of the sum as a digit of the the original number times the quantity $\left( 1+9\cdots 9 \right)$ where the symbol “$9\cdots 9$” is 9 or 99 or 999 or 9999 and so forth.

$X\quad =\quad { a }_{ 0 }+\sum _{ i=1 }^{ n }{ { a }_{ i } } \left( 1+9\cdots 9 \right)$

This way of writing the number makes it clear what happens when each digit is distributed over the its corresponding sum and the the sum regrouped so that the sum of the digits of the original number are distinct from the rest of the number.

$X\quad =\quad { a }_{ 0 }+\sum _{ i=1 }^{ n }{ { a }_{ i } } +\sum _{ i=1 }^{ n }{ { a }_{ i } } \left( 9\cdots 9 \right)$

Now it is clear that each term of the rightmost sum can be factored by the number nine giving the formula below. The symbol “$1\cdots 1$” is 1 or 11 or 111 or 1111 and so forth.

$X\quad =\quad { a }_{ 0 }+\sum _{ i=1 }^{ n }{ { a }_{ i } } +\quad 9\sum _{ i=1 }^{ n }{ { a }_{ i } } \left( 1\cdots 1 \right)$

Recalling that the original number is a multiple of nine we get the following:

$9x\quad =\quad { a }_{ 0 }+\sum _{ i=1 }^{ n }{ { a }_{ i } } +\quad 9\sum _{ i=1 }^{ n }{ { a }_{ i } } \left( 1\cdots 1 \right)$

Finally subtracting the rightmost sum from both sides of the formula and factoring out the number nine we get the following which does show that the sum of the digits of the original number is a multiple of nine.

$9\left[ x-\sum _{ i=1 }^{ n }{ { a }_{ i } } \left( 1\cdots 1 \right) \right] ={ a }_{ 0 }+\sum _{ i=1 }^{ n }{ { a }_{ i } } \quad$