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$$ if and only if $$\sum_{i=0}^{n-1} (3^i X_i)$$ is divisible by $$7$$.

Direct Proof
$$ $$ $$ $$

The first addend is always divisible by $$7$$ because $$10^i - 3^i$$ always produces a number divisible by $$7$$ from difference of two powers. So $$X$$ will be divisible by $$7$$ if and only if the second addend is divisible by $$7$$.