Pick a number, any number ((OK, any positive integer. Nobody likes a smartarse.)) Let’s say 24,876,028, one of my favourites in the 20-millions. I can tell by looking at it that it’s one more than a multiple of 9.

It’s not that clever a trick: I just added up the digits (getting 37), and repeated the trick with that number (10), and one more time (1). In fact, I didn’t even do that: whenever I got above 9, I subtracted it. This works with any number you like: add up the digits, and repeat the process until you get a single digit, and that result will be the remainder when you divide the number by 9.

Why is that? Well, *that’s* where the neat maths comes in. I can take away any multiple of nine from my number without changing its remainder. In particular, 20,000,000 is $2 \times 9,999,999 + 2$, and 4,000,000 is $4 \times 999,999 + 4$, and so on.

That means: $24,876,028 = (2 \times 9,999,999 + 2) + (4 \times 999,999 + 4) + (8 \times 99,999+8) + (7 \times 9,999 + 7) + (6\times 999 + 6) + (2\times 9 + 2) + 8$. The first term in each bracket is a multiple of 9, which can be discarded if we’re interested in the remainder. The second in each is simply the digit itself - so $24,876,028 \equiv (2 + 4 + 8 + 7 + 6 + 0 + 2 + 8) \pmod{9}$.

A consequence of this is that any number whose digits sum to a multiple of 9 is itself a multiple of 9, and a similar result for multiples of 3 follows much the same way.