Solution (source code)

= Solution

The decimal expansion is $a=\sum_{i=0}^m a_i10^i$. Since $10\equiv1\pmod3$, repeated use of the multiplication rule in part (b)(ii) gives $10^i\equiv1\pmod3$ for every $i\geq0$. Repeated use of the addition rule in part (b)(i) now gives
$$
a=\sum_{i=0}^m a_i10^i\equiv\sum_{i=0}^m a_i\pmod3.
$$
If $3\mid a$, the left side is congruent to zero, whence
$$
\boxed{3\mid\sum_{i=0}^m a_i.}
$$
This is the <decimal digit-sum divisibility test> for three, derived directly from <modular arithmetic>.