<s>[INST] Prove that if $a_{n+1} = a_n^2$, the last $n$ digits of $a_{n+1}$ are the same as the last $n$ digits of $a_n$. I have been working on this problem for a while. I know that I have to prove it using induction, but I'm unsure of the next step. The formula for the terms is: $a_{n+1} = 5^{2n}$ with $a_1 = 5$. The sequence is 5, 25, 625, etc. This is what I have thus far:
$a_{n+1} = a_n^2 = 5^{2n}$
$5^{2(n+1)} - 5^{2n} \equiv 0 \pmod {10^{n+1}}$
$5^{2n}5^2 - 5^{2n} \equiv 0 \pmod {10^{n+1}}$
$5^{2n}(24) \equiv 0 \pmod {10^{n+1}}$
Any hints? Thanks
 [/INST] Assuming that the formula is actually $a_{n+1} = 5^{2^n}$ (which matches up with $a_{n+1} = a_n^2$ and $a_1 = 5$), then we have as follows:
$a_{n+1} - a_n = 5^{2^n} - 5^{2^{n-1}} = (5^{2^{n-1}})^2 - 5^{2^{n-1}} = 5^{2^{n-1}}(5^{2^{n-1}} - 1)$, and we want to show that this number is divisible by $10^n$.
Since $5$ and $2^n$ are coprime, we know from Euler's theorem that
$5^{2^{n-1}} \equiv 1 \pmod {2^n}$, since $\phi(2^n) = 2^{n-1}$. 
Thus, $(5^{2^{n-1}} - 1)$ is divisible by $2^n$.
For $n > 1$, we know that $2^{n-1} \geq n$, so $5^{2^{n-1}}$ is divisible by $5^n$.
Therefore, $5^{2^{n-1}}(5^{2^{n-1}} - 1)$ is divisible by both $5^n$ and $2^n$, and is therefore divisible by $10^n$ and we're done.
</s>