Why is it that if a numbers is divisible by three, then the digits are also divisible by three?
Consider every integer x can be written as
x=i∈Z∑ai10i
where Z is the set of all integers, and \(a_i \in {0, 1, …, 9}\) for all i∈Z. This can be rewritten as
x=i∈Z∑ai(10i−1+1)
It follows that if 10i−1 is divisible by three for all i∈Z+ then it follows that x is divisible by three if the sum of the digits are also divisible by three since:
i∈Z∑ai(10i−1+1)mod3=i∈Z∑aimod3
Lets begin by proving that 10i−1 is divisible by three for all i∈Z.
If i=0, then we know that 0 is clearly divisible by three. We can also easily verify this is true for i=1 since 10−1=9 is clearly divisible by three.
Now assuming that case i=k holds, we need to demonstrate that case k+1 also hold.
So assuming that
10k−1mod3=0
then
10k+1−1mod3=(10k−1+1)×10−1mod3
Since we have assumed that 10k−1mod3=0, the expression above simplifies to:
10−1mod3=9mod3=0
as required.
Therefore since
x=i∈Z∑ai10i=i∈Z∑ai(10i−1+1)
Then
x=i∈Z∑ai(10i−1+1)mod3=i∈Z∑aimod3
as required.