# Proof of divisibility by 7 rules

I am stuck on a problem involved with proving divisibility rules for 7.

Let $n\in \mathbb{N}$ and let $\displaystyle n=\sum_{i=0}^k a_i \cdot 10^i$ be its decimal expression where $a_i\in \{0,1,2,3,4,5,6,7,8,9\}$. Find a necessary and sufficient condition on $\{a_i\}$ so that $7|n$, and please provide proof.

Basically this problem asks you to give a set of rules to predict the divisibility of 7. For instance, for an integer to be divisible by 3, the sum of its digits must be divisible by 3. So I need to get a rule for that. I have wiki'ed the rule and know what it is, but I also need to provide proof. That is where I am stuck.

• I know of at least $5$ tests on divisibility by $7$. You should tell us which one you want to prove. – EuYu Feb 28 '14 at 5:22
• math.stackexchange.com/questions/328562/… – lab bhattacharjee Feb 28 '14 at 5:24
• I guess which ever one that is the simplest to prove. – mrQWERTY Feb 28 '14 at 5:29

Hint: To prove, use this recursively: $10A+B=10(A-2B) \mod 7$.