TITLE: Prove that a number is divisible by 3 iff the sum of its digits is divisible by 3
QUESTION [9 upvotes]: I'm trying to teach myself some number theory. In my textbook, this proof is given:

Example (2.3.1) Show that an integer is divisible by 3 if and only if the sum of its digits is a multiple of 3.
Let $n=a_0a_1\ldots a_k$ be the decimal representation of an integer $n$. Thus $n=a_k+a_{k-1}10+a_{k-2}10^2+\cdots+a_010^k$ where $0\le a_i<10$ The key observation is that $10\equiv1\pmod3$, i.e., $[10]=[1]$. Hence $[10^i]=[10]^i=[1]$, i.e., $10^i\equiv1\pmod 3$. The assertion is an immediate consequence of this congruence.

I don't understand the last statement. Why does it follow from that congruence?

REPLY [4 votes]: The assertion is an immediate consequence of this congruence.

Since any power of $10$ is congruent to $1$ (mod $3$),
$$n=a_k+a_{k-1}10+a_{k-2}10^2+\cdots+a_010^k\equiv a_k+a_{k-1}+a_{k-2}+\cdots+a_0\pmod3.$$
In other words, the residual of dividing $n$ by $3$ is the same as the residual of dividing the sum of its digits by $3$.  In the case of zero residual, we get the sought assertion: $n$ is divisible by $3$ iff the sum of its digits is divisible by $3$.