9

by fogus

John Cook’s 7 post reminded me of 9


It is 1am and I cannot sleep; therefore I think (which may be at the root of my problem). For your entertainment, I give you the number nine. I am currently obsessed with 9, and this blog represents a small fraction of the reasons why.

The number nine has magical properties. First, as everyone knows in order to determine if a number is divisible by 9, one need only to add its digits (and those of its sum recursively). If they equal nine, then you have your answer.


17 => 1 + 7 = 8 :(
18 => 1 + 8 = 9 :)
55 => 5 + 5 = 10 :(
54 => 5 + 4 = 9 :)
5994 => 5 + 9 + 9 + 4 = 27 => 2 + 7 = 9 :)
48,762 => 4 + 8 + 7 + 6 + 2 = 27 => 2 + 7 = 9 :)
49,650 => 4 + 9 + 6 + 5 + 0 = 24 => 2 + 4 = 6 :(

… and so on.

There is also something called the beautiful table of nines. One can construct this table simply by started at 1 and continuing forever by multiplying each successive number by 9. Another way to construct this table is to realize that there is a pattern underlying its construction. That is, if you look at the right-most number in this table (n x 1 table that is) you will see that it starts at 9 and counts down to 0. Likewise the left-most n columns start at 1 if there is no digit to their left (otherwise they start at 0) and count up to 9. Visually, this looks like:

1 x 9 = 9
2 x 9 = 18
3 x 9 = 27
.
.
.
31 x 9 = 279
32 x 9 = 288
33 x 9 = 297
.
.
.
inf

Further, 9 can be used to check the result of any addition. That is, taken any two numbers and their supposed sum, we first take the modulo of each of those numbers to 9. If the sum of the first two remainders does not equal the final remainder, then the supposed sum was likewise incorrect. Likewise, this method can be used to check multiplication by taking the aforementioned remainders and multiplying them. If the product of the first two does not equal the final remainder, then the original product was not correct. For example:

52 + 67 = 119
52 % 9 = 7
67 % 9 = 4
119 % 9 = 2
7 + 4 = 11 !?!?

This is OK. When the sum of the first two remainders equals a number > 9, then the remainder for the original sum represents the offset from 9. In the above example, the offset from 9 is 2 which is therefore 11. An example that illustrates the original premise would be:

33 + 11 = 44
33 % 9 = 6
11 % 9 = 2
44 % 9 = 8
6 + 2 = 8 :)

For the case of multiplication, the same principles hold true:

10 x 12 = 120
10 % 9 = 1
12 % 9 = 3
120 % 9 = 3
1 x 3 = 3 :)

For very large numbers, it may be impractical to find the modulo to 9. Instead, one can throw out all of the nines embedded in the numbers and use the remaining numbers to validate the sums and products. What the Hell does that mean? To elaborate:

1567 + 727 = 2294
5 + 6 + 7 = 18 => 1 + 8 = 9 <-- throw away -- left with 1
7 + 2 = 9 <-- throw away -- left with 7
9 <-- throw away -- left with 2 + 2 + 4 = 8
1 + 7 = 8 :)

The same goes for multiplication. However, there is a caveat when one of the numbers is a multiple of 9. I leave that exercise to the reader… I’m tired.

:f