Take a two-digit base-10 number where the digits are represented by *ab*. This number is equal to 10*a* + *b* and the sum of its digits are *a* + *b*.

The difference between the number and the sum is 9*a*, which is divisible by three. So *a* + *b* is divisible by three, if and only if, 10*a* + *b* is divisible by three. 9*a* is also divisible by nine, meaning that the rule applies to nine as well as three.

With a three-digit base-10 number, the number is equal to 100*a* + 10*b* + *c* and the sum is *a* + *b* + *c*. The difference between the number and the sum are 99*a* + 9*b*, which is divisible by three and nine. Four-digit numbers, five-digit numbers, etc. work the same way.