You are invited to Log in or Register a free Frihost Account!

# Math trick explanation wanted.

ocalhoun
Okay, recently I've grown curious thinking about this... and before I spend hours pondering it... maybe someone can explain it.

So: First of all, it's an interesting fact that any number is (evenly) divisible by 3 if (and only if) all the digits of that number add up to a number divisible by 3.

So,
102: 1 + 0 + 2 = 3 : 102 is divisible by 3.
672: 6 + 7 + 2 = 15 : 672 is divisible by 3.
712: 7 + 1 + 2 = 10 :712 is not divisible by 3.
42: 4 + 2 = 6 : 42 is divisible by 3.
74945670: 7 + 4 + 9 + 4 + 5 + 6 + 7 + 0 = 42 : 74945670 is divisible by 3.

This also works for 9 (3^2), and for 27 (3^3)... and so on.
(ie, 8010: 8 + 0 + 1 + 0 = 9: 8010 is divisible by 9...
90828: 9 + 0 + 8 + 2 + 8 = 27: 90828 is divisible by 27.)

But it does NOT work for any number that is not a (positive integer) power of 3.

Neat math trick and all... but it has me wondering:
WHY?

Why does this work, and how?
Is it a quirk of our base-10 number system? Would base 8 or base 16 or something have a different number that behaved like this?
...After some thinking about it, base 8 doesn't seem to have such a number, and this trick with the threes doesn't seem to work in base 8.

...But still, how does this work?
Not understanding it is about to drive me crazy.
Bikerman
Suggested starting point.
Let your 3 numbers be 100a+10b+c = n
do a bit of sleight
99a+a + 9b+b + c = n

now factorise and you should see why
SonLight
seven should work in base eight, and f (aka 15 decimal) should work in base 16. The peculiar thing about decimal is that 9 is a square, so you can use the shortcut with either 3 or 9.

Bikerman has nicely explained it for decimal. Here are similar formulas for octal and hexadecimal:

(all numbers here represented in decimal notation)

64a + 8b + c = n, rewrite as

49a + a + 7b + b + c = n

256a + 16b + c = n, rewrite as

255a + a + 15b + b + c = n
Bikerman
Yes, nice continuation of the basic idea.
I wasn't meaning to be mysterious - for those who still don't see it - I just wanted to give Ocalhoun the thrill of discovery that I get when I work something out - even if it is already well known.

To complete the explanation.
99a+a+9b+b+c = n
(99a+9b) + (a+b+c) = n
we know that 99a+9b MUST be divisible by 3 so it follows that IFF (if and only if) a+b+c is divisible by 3 then n is divisible by 3. QED.

(The above is far from rigorous, but I ask for a bit of indulgence because a rigorous proof would be quite long).
_AVG_
Interesting, there was a time when the so called "divisibility tests" had me baffled, until I found Modular Arithmetic/Algebra. A lot of these "tests" arise from the following theorem:

if a mod(b) is equivalent to c, then f(a) mod(b) is equivalent to f(c); provided f(x) is a polynomial with integer coefficients.

So, for the case of 3, if we have a number a:
10 mod(3) is equivalent to 1 (and we can split a into its digits a_n, a_n-1, ....... , a_1, a_0)
take f(x) = a_n(x^n) + a_n-1(x^n-1) + ...... + a_1(x) + a_0
So f(10) mod(3) is equivalent to f(1)
i.e. a_n(10^n) + a_n-1(x^n-1) + ..... + a_1(10) + a_0 (which is just a) is equivalent to:
a_n + a_n-1 + ....... + a_1 + a_0 (which is just the sum of digits of a)
hence we have that a is divisible by three if and only if the sum of the digits of a is divisible by 3.

This works for 9 as well because 10 mod(9) is equivalent to 1 as well
However 27 will be a more difficult case I think
rajivsharma0723
Vedic Mathematics is also helpful to learn these short tips and easy to understand.

http://www.freematheducation.com