Divisibilty by 3 can be easily be proved by modular arithmetic.
Suppose we have a number $A$ which is :
$A = a_n \cdot 10^n+a_{n-1} \cdot 10^{n-1}+a_{n-2} \cdot 10^{n-2}+ \cdots + a_2 \cdot 10^2 +a_1 \cdot 10+ a_0 $
We know
$1 \equiv 10 \pmod{3}$
Therefore we substitute 10 s with 1 s :
$A = a_n \cdot 10^n+a_{n-1} \cdot 10^{n-1}+a_{n-2} \cdot 10^{n-2}+ \cdots + a_2 \cdot 10^2 +a_1 \cdot 10+ a_0 \equiv a_n \cdot 1+a_{n-1} \cdot 1 + a_{n-2} \cdot 1 + \cdots + a_2 \cdot 1 +a_1 \cdot 1 + a_0$
You can see that if a number wants to be divisible by 3 sum of all of its digits should be divisible by 3
Hope that helped!