<s>[INST] Prove that $7$ divides $1 + 2^{(2^n)} + 2^{(2^{n+1})}$ by induction Prove that $7$ divides $1 + 2^{(2^n)} + 2^{(2^{n+1})}$ by induction.
I ran into the above problem. The base case $n=1$ gives $21$ which is divisible by $7$.
Now assume it is true for $n$. Then for $n+1$, we have the expression
$$ 1 + 2^{(2^{n+1})} + 2^{(2^{n+2})}$$
which is equal to
$$1 + 2^{(2^n\cdot 2)} + 2^{(2^n \cdot 2^2)}$$
but I do not really see how it helps.
Any ideas?
 [/INST] As in Winther's post let $x_n=2^{2^n}$. Then the sequence is 
$I_n=1+x_n+x_n^2$, and $x_{n+1}=x_n^2$.
We suppose $I_n\equiv0\pmod 7 \implies x_n+x_n^2\equiv-1 \pmod 7$, 
squaring both sides:
$x_n^2+2x_n^3+x_n^4\equiv1 \implies I_{n+1}=1+x_n^2+x_n^4\equiv 2(1-x_n^3)\equiv 0 \pmod 7$ 
since $x_n^3=2^{3\cdot2^n}\equiv1^{2^n}\equiv 1 \pmod 7$
</s>