# Analyzing Scott Flansburg’s Nines Trick

There’s an old math trick that goes like so – choose any number… say 171…. add the digits and subtract.
171-9 = 162
Take its sum of digits and subtract them…
162 – 9 = 153
Take its sum of digits and subtract them…
153 – 9 = 134
134-8 = 126
126-9 = 117
117-9 = 108
108-9 = 99
99-18 = 81
81-9=72
72-9=63
64-9=55
55-10=45
45-9=36
36-9=27
27-9=18
18-9 = 9

As had been noted elsewhere, it is pretty easy to see the result in each case is going to be a multiple of nine… and as long as you keep subtracting a number smaller than itself, it is going to eventually go to the irreducible 9… but why does this work? Does this work in other bases?

Let’s try this in base 16 – hexadecimal. If you aren’t a computer guy, this may need some review – “10” is called two, the number two, in base 2. “10” is called ten, the number 10, in base ten. “10” is called sixteen (the number sixteen), in hex, with the following digits:

1=1
2=2

9=9
A=10
B=11
C=12
D=13
E=14
F=15
and of course after 15, the next uses the second digit, 10 = sixteen.

Let’s try and see the pattern: In “normal numbers” 11-2 is obviously 9 and 12-3 is 9, continue on for any two digit number and you’ll see a pattern. Now try in base 16, where 11 is (16+1) and 11-2 is 15(“F”), and 12 – 3 (16+2,-3) is 15 (“F”). Which is the largest one digit in base 16. (n-1 = 15).

This is starting to look like an easy pattern, and if you continually subtract from a number and keep subtracting, getting multiples of “nine” (well, n-1 for base n), you will of course keep getting smaller multiples of that “nine”(n-1). BUT that is not a proof, and as any mathematician knows, even programming your computer to calculate thousands of these does not guarantee that this is a rule! Let’s see why we can know that subtracting the sum of digits always gives a lesser multiple of the “nine” (n-1 for base n):

Let’s call a three digit number “abc” algebraically, which has a numeric value of n2a+nb+c (in base 10, that is 10*10*a+10*b+c)

Subtracting the sum of digits gives no end digit numerically, it is subtracted, also there is one less b*n and one less b*n*n so the result is:

n2a+nb+c -a -b -c = (n2-1)a + (n-1)b

What is n2-1 and does it divide by the nine? In other words what (n-1)(____) will multiply to n2-1 ? ( remember your algebra, try this… scroll down for the answer and final proof.)

n2-1 is (n-1)(n+1) as you may recall from algebra. Let’s see if the pattern continues for 4 digit numbers:

“abcd” number is n3a+n2b+nc+d. Subtract a+b+c+d and you get:

(n3-1)a+(n2-1)b+(n-1)c

As above, we can reduce that first part to (n-1)(n2+n+1) = n3-1 (remember cartesian product of two is the sum of all combinations… -1 portion and multiplication cancels out the middle terms. In similar manner, n5-1 = (n-1)(n4+n3+n2+n+1)

So (n3-1)a+(n2-1)b+(n-1)c = (n-1)(n2+1)a+(n-1)(n+1)b+(n-1)c. Divide that by “nine”(that is, n-1, 9 for base 10), and you will get:

(n-1)*((n2+1)a+(n+1)b+c)

That just factors out, and it is a whole number to the right. Similarly you can show that any nx-1 times a digit number, can be the (n-1)(n(x-1)+ … 1) and so you will keep getting nine-divisible number after each subtraction, for any number in any base.