Decimal digit-sum divisibility test (source code)

= Decimal digit-sum divisibility test
{title2=$a\equiv\sum_i a_i\pmod d\quad(d\mid9)$}

For a nonnegative <integer> with decimal expansion $a=\sum_i a_i10^i$, the congruence $10\equiv1\pmod d$ gives $a\equiv\sum_i a_i\pmod d$ whenever $d\mid9$. Thus <divisibility> by three or nine is equivalent to <divisibility> of the sum of its <decimal digits> by the same number. More generally a base-$b$ expansion has the analogous rule for every divisor of $b-1$. This follows by repeated addition and multiplication in <modular arithmetic>; it does not require an empirical rule about decimal notation.