“Casting out nines” is a trick for determining the remainder when a number is divided by nine. Just add the digits of the number together. For example, what’s the remainder when 3679 is divided by 9? The same as when 3+6+7+9 = 25 is divided by 9. We can apply the same trick again: 2+5 = 7, so the remainder is 8.
The “casting out” part of the name refers to the fact that you can ignore 9’s along the way because they don’t effect the final sum. In the example above, we could see that the result would be 7 by “casting out” 36 and 9.
Casting out nines works because 9 is one less than 10, i.e. one less than the base we use to represent numbers. The analogous trick would work casting out (b-1)’s in base b. So you could cast out 7’s in base 8, or F‘s in base 16, or Z’s in base 36.
Why can you cast out (b-1)’s in base b? First, a number written is base b is a polynomial in b. If the representation of a number x is anan-1 … a1a0 then
x = anbn + an-1bn-1 + … + a1b + a0.
Since
bm – 1 = (b – 1)(bm-1 + bm-2 + … + 1)
it follows that bm leaves a remainder of 1 when divided by b – 1. So ambm leaves the same remainder as am when divided by b – 1. If follows that
anbn + an-1bn-1 + … + a1b + a0
has the same remainder when divided by b – 1 as
an + an-1 + … + a1 + a0
does when it is divided by b – 1.
Related posts