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.