Prove that $5^n \equiv 8n^2-4n+1 \mod 64$ using induction
Using binomial expansion,
$$5^n=(1+4)^n=1+\binom n1 4 + \binom n2 4^2 + \binom n3 \color{blue}{4^3} + \binom n4 \color{blue}{4^4} +\cdots + \binom nn \color{blue}{4^n}.$$
Since the binomial coefficients are integers and $4^3=64$, we have
$$5^n\equiv1+4n+8n(n-1)=8n^2-4n+1\bmod64.$$
Hint: $5(8n^2-4n+1)-(8(n+1)^2-4(n+1)+1)= 32 n (n - 1) \equiv 0 \bmod 64$