Divisibility by 7

Theorem
An integer $X$ with $n$ digits ($X_0$ in the ones place, $X_1$ in the tens place, and so on) is divisible by $7$ :
 * $\displaystyle \sum_{i \mathop = 0}^{n - 1} \paren {3^i X_i}$ is divisible by $7$.

Proof
From Difference of Two Powers, $10^i - 3^i$ always produces a number divisible by $7$.

Thus the first addend is always divisible by $7$.

So $X$ will be divisible by $7$ the second addend is divisible by $7$.

Hence the result.