Im not sure about this way , but the result works
First express \(\displaystyle n\) as powers of \(\displaystyle 10\) , example: \(\displaystyle 273=10^2 \cdot 2 +10^1 \cdot 7 +10^0 \cdot 3\)
Let \(\displaystyle x_1,x_2,...,x_k\) be the digits of \(\displaystyle n\)
\(\displaystyle n=10^{k-1}x_k + 10^{k-2}x_{k-1} + ...+10x_2+x_1=(10^{k-1}-1)x_k +x_k+(10^{k-2}-1)x_{k-1} + x_{k-1} +...+9x_2 + x_2 +x_1\)
\(\displaystyle 10^p -1\) is a multiple of \(\displaystyle 9\), so write \(\displaystyle 10^p -1=9a\)
\(\displaystyle n=9a_k x_k +x_k +9a_{k-1}x_{k-1}+x_{k-1} +...+9x_2 +x_2 +x_1\)
\(\displaystyle n=9(a_k x_k +a_{k-1}x_{k-1}+...+x_2)+(x_1+x_2+...+x_k)\)
\(\displaystyle 3|9(a_k x_k +a_{k-1}x_{k-1}+...+x_2)\) but also \(\displaystyle 3\) must divide the other part of the sum (if 3|p and 3|q , then 3|(p+q))
so \(\displaystyle 3|(x_1+x_2+...+x_k)\)