Let’s break it up and look at the individual digits and see what their mod 9’s are.
9 mod 9 = 0
80 mod 9 = 8
100 mod 9 = 1
2000 mod 9 = 2
30000 mod 9 = 3
100000 mod 9 = 1
You can see that any digit `n00000…000 mod 9 = n`.
If we have `n * 10^x`, we can represent it another way. It would also be `m999999…999 + 1`, where `m=n-1` (m could be 0). Rewrite it a little more and you’ll get `m000…000 + 999…999 + 1`. Take the mod9 of that, and that `999…999` disappears.
So now you’re left with the mod of `m000…000 + 1`. Basically we’ve substituted the earlier problem with *m* in place of *n*, but now we’ve added 1. For any starting value n, if we iterate this process *n* times, then we end up adding 1 *n* times, and we reduce *m* to 0. This, our modulus after all of that is just *n*.
So that means that `n*10^x mod 9 = n`. Since modulus can be done both before or after adding, then taking the mod 9 of a number is the same as adding all the digits.
Also, gotta watch out for any numbers that are equal to 0 when mod 9’d. Their digital root is actually 9, but in a mod 9 world that’s 0. The number 0 is also equal to 0 when mod 9’d, so watch out.
Latest Answers