Let $n=4\cdot p^t+1.$ Is $r_k=4$ for some $1\le kLet $n=4\cdot p^t+1$, $t\ge1$ and $p\ge5$ prime. 
Define sequence $R$ as follows; 
$r_0=4,$ $r_{k+1}\equiv r_k^2-2\pmod n$, $0\le r_k<n$ for $k\ge1$. 
It appears that whenever $n$ is prime,  $r_k=4$ for some  positive integer $k<n$. How does one go about proving this result for all primes $p\ge5$ and positive integers $t$? Are there any counter examples? (I have done a search for all $p<10^6$ with $t=1,2$. No counter examples.)

I can't seem to find a solution using only elementary number theory. From what I did find, it's obvious that we need
$$r_{k-1}^2-2\equiv 4 \text{ mod } n$$
$$r_{k-1}^2\equiv 6 \text{ mod } n$$
By the Law of Quadratic Reciprocity
$$\left( \frac{2}{n} \right) \equiv (-1)^\frac{n^2-1}{8}\equiv (-1)^{\frac{(4p^k)(4p^k+2)}{8}}\equiv (-1)^{(p^k)(2*p^k+1)}=-1 $$
Additionally,
$$\left( \frac{3}{n} \right) =-1 $$ since by the Law of Quadratic Reciprocity,
$$\left( \frac{3}{n} \right)\left( \frac{n}{3} \right) =(-1)^{\frac{n-1}{2}\frac{3-1}{2}} = (-1)^{2*p^k}=1$$ and
$p \text{ mod } 3 \equiv 1,2$
$p^k \text{ mod } 3 \equiv 1,2$
$n \equiv 4p^k+1 \text{ mod } 3 \equiv 2,0$
Since $2$ is a quadratic nonresidue mod $3$, and n is defined as a prime greater than or equal to 5, then n cannot be a multiple of 3. Therefore,
$$\left( \frac{n}{3} \right)=-1$$
Since the Legendre Function is multiplicative, we get
$$\left( \frac{6}{n} \right)=\left( \frac{3}{n} \right)\left( \frac{2}{n} \right)=1$$, and so 6 is a quadratic residue mod n. This implies that it is possible for the number 4 to be reached again in a sequence like that. From there however, I can't seem to find any literature on how to continue, other than references to the Pisano Period (which has a derivation referring to algebraic number theory) and a closed-form for the recursion $r_k=r_{k-1}^2-2$ in the page for "Proof of correctness" in the Wikipedia page for the Lucas Lehmer primality test, which introduces the same recursion.
