Threes
May 24, 2021
There are smells that bring me back in time.
Fresh bread, Elmer's glue, and when I return to some parts of the Bay area there is a tree smell that always reminds me of my third grade year that we spent in Palo Alto.
But there are other specific triggers that take me back. One of them was the result of a tweet from my friend Matt last night:
"My third grader just schooled me hard. Apparently you can tell at a glance if any base10 number is divisible by three by adding its digits together. 5286 -> 5+2+8+6 = 21. Divisible by three."
I remembered learning this as a kid and I remember it later being one of the first "non-stupid" uses of all of those rules we had learned in algebra class.
Matt's example of 5286 is actually 5 * 1000 + 2 * 100 + 8 * 10 + 6 and he's saying we can determine whether it is divisible by 3 just by adding the 5, 2, 8, and 6.
Well check this out, we can rewrite 1000 as 999 + 1, 100 as 99 + 1, and 10 as 9 + 1 and
5286 = 5 * 1000 + 2 * 100 + 8 * 10 + 6
= 5 * (999 + 1) + 2 * (99 + 1) + 8 * (9 + 1) + 6
The distributive law that you might remember tells us we can distribute the multiplication over addition like this.
= 5 * 999 + 5 * 1 + 2 * 99 + 2 * 1 + 8 * 9 + 8 * 1 + 6
Nobody would write 5 * 1. We write 5. So this becomes
= 5 * 999 + 5 + 2 * 99 + 2 + 8 * 9 + 8 + 6
Let's group together those things that aren't multiples of 9, 99, of 999 using the commutative and associative laws.
= (5 + 2 + 8 + 6) + (5 * 999 + 2 * 99 + 8 * 9)
And now make the observation that everything in the second group is divisible by 9. So we can factor out the 9. I don't really care what's left - just that everything is divisible by 9.
= (5 + 2 + 8 + 6) + 9 * (something)
If all we care is that our original number is divisible by 3, then the 9 * something part is so all we need to check is the rest of it.
So 5286 is divisible by 3 if 5 + 2 + 8 + 6 is.
We've actually also shown that 5286 is divisible by 9 if 5 + 2 + 8 + 6 is.
So 5286 is divisible by 3 but not by 9.
There's nothing in our sketch of a proof that involves the 5, 2, 8, or 6 - it works for any four digit number. This also works for any number base ten because any power of ten is one more than a series of nines we can always break our number into the sum of the digits and a multiple of nine.
Notice also this rule says you can keep adding. As Matt pointed out in his tweet
5 + 2 + 8 + 6 = 21
"And if you happen to not know 21, just go again. 2+1=3"
So we have simple rules for three and nine.
Six is not so simple. For example 15 is not divisible by 6 even though 1 + 5 = 6.
For multiples of six the simplest thing is to apply two rules: it must both be divisible by three (which 15 is) and it must be even (which 15 isn't). So the rule for 6 is sum the digits and if the sum is a multiple of three and the number is even, then it's a multiple of 6.
As Scott pointed out in a reply to the original tweet, we can determine whether a number is divisible by 2, 5, or 10 but looking at the digit in the ones place.
In other words, a number is even if it ends with 2, 4, 6, 8, or 0, divisible by 5 if it ends in 5 or 0, and divisible by 10 if it ends in 0.
This is because any integer base ten can be written as 10 * something + the one's digit. Since 10 is divisible by 2, 5, and 10 we can ignore everything but that one's digit.
OK. That gives us rules for dividing by 2, 3, 5, 6, and 9. There are rules for 4, 7, and 8 but mostly they aren't worth while. For 4, I take the last two digits and divide by 2 and see if the result is odd or even. I never remember the rule for 7 and the rule for 8 is more work than it's worth.
Anyway, the tweet brought a smile to my face and reminded me of a happy time "discovering" the magic of numbers.
PS
After I posted this, Vadim Drobinin sent me this really nice tweet with a visualization of the divisible by 7 rule. Pick a number you know to be divisible by seven and try it. Pick a number you know is not.