[Math] Proof for divisibility by $7$

divisibilitynumber theory

One very classic story about divisibility is something like this.

A number is divisible by $2^n$ if the last $n$-digit of the number is divisible by $2^n$.
A number is divisible by 3 (resp., by 9) if the sum of its digit is divisible by 3 (resp., by 9).
A number $\overline{a_1a_2\ldots a_n}$ is divisible by 7 if $\overline{a_1a_2\ldots a_{n-1}} – 2\times a_n$ is divisible by 7 too.

The first two statements are very well known and quite easy to prove. However I could not find the way on proving the third statement.

PS: $\overline{a_1a_2\ldots a_n}$ means the digits of the number itself, not to be confused with multiplication of number.

Best Answer

$$5(\overline{a_1a_2\ldots a_n})=50(\overline{a_1a_2\ldots a_{n-1}})+5a_n=\overline{a_1a_2\ldots a_{n-1}}-2a_n\pmod{7}$$

Related Question