I came across this rule of divisibility by 7:
Let N be a positive integer. Partition N into a collection of 3-digit numbers from the right (d3d2d1, d6d5d4, ...).
N is divisible by 7 if, and only if, the alternating sum S = d3d2d1 - d6d5d4 + d9d8d7 - ... is divisible by 7.
I'm trying to prove this rule. Though I'm sure this might be done using modular arithmetic, I haven't reached anything useful. I have searched for a proof and haven't found one. Any idea or hint will be appreciated.
Thanks a lot.