This question already has an answer here:
I came across a strange property of $3$ in base $10$; for all integers I have tried, the following rule seems to be true:
The integer '$n$' is divisible by $3$ if the sum of the digits of the integer are also divisible by three.
Is there a proof to show that this in fact is true? Or a counter example to disprove?
An example of the rule:
Suppose '$n$' = $123456789$.
Then $$ 1+2+3+4+5+6+7+8+9 = 45 $$ $$ 4+5 = 9 $$ $$ 9 \mod 3 = 0 $$ Therefore
$$ 123456789 \mod 3 = 0 $$
Afterword: For those of you who are wondering, I realized this rule while working on a database where every third row had a value I was wanted. What I wanted was a way to determine if a given row number '$n$' was divisible by $3$ without actually performing the function $n/3 = 0?$ and so far the rule I came up hasn't failed.