Consider, as an example, a four digit number \(ABCD\).
The value of this number is: \(1000A+100B+10C+D\).
This value can be rewritten as: \((999+1)A+(99+1)B+(9+1)C+D\)
Which expands to: \(999A+99B+9C+A+B+C+D\)
Dividing this expression by \(3\) gives: \(333A+33B+3C+(A+B+C+D)/3\)
Thus if \((A+B+C+D)\) is divisible by \(3\), the entire expression, which is equivalent to the original \(ABCD\) number, will then have been divisible by \(3\).
This same rationale can be extended to include a number of any length.
It is noted that if \((A+B+C+D)\) is divisible by \(9\), then the expression \((999A+99B+9C+A+B+C+D)\), which is equivalent to the original \(ABCD\) number, will then have been divisible by \(9\).
John Schwarz