Show that the number 9 divides the number $ m$ if and only if the sum of the digits of the number $ m $ is divisible by 9.
Show that the number 3 divides the number $ m$ if and only if the sum of the digits of the number $ m $ is divisible by 3.
Are semigroup and monoid theory could be useful?
As $\displaystyle10\equiv1\pmod9, 10^r\equiv1$ for integer $r\ge0$
$$\implies\sum_{r=0}^na_r10^r\equiv\sum_{r=0}^na_r\pmod9$$
More generally for base $b,$ as $\displaystyle b\equiv1\pmod{b-1}\implies b^r\equiv1$ for integer $r\ge0$
$$\sum_{r=0}^na_rb^r\equiv\sum_{r=0}^na_r\pmod{b-1}$$