# Proving the existence of consecutive quadratic residues modulo $p>5$ by means of Pell's equation

When I read Existence of Consecutive Quadratic residues I thought we might be able to prove the existence of non-zero consecutive quadratic residues modulo a prime $p>5$ using the theory of Pell-type equations: if $d>1$ is a quadratic residue modulo $p$, then any solution $(x,y)$ to $x^2-dy^2=1$ gives rise to consecutive quadratic residues $(x^2,dy^2)$ modulo $p$. It seems a promising method to me; the only problem lies in making sure that $x$ and $y$ aren't divisible by $p$.

Can we show that for any prime $p>5$, there exists a quadratic residue $d>1$ modulo $p$ and a solution $(x,y)$ to $x^2-dy^2=1$ s.t. $p\nmid x,y$?

That's a lovely idea, but there is an issue. Given a Pell equation: $$x^2-dy^2 = 1$$ its solutions $(x_0,y_0)=(1,0),(x_1,y_1),\ldots$ may be arranged in such a way that both the sequences $\{x_n\}_{n\geq 0}$ and $\{y_n\}_{n\geq 0}$ are Fibonacci-like sequences with the same characteristic polynomial, whose coefficients depend on the fundamental solution $(x_1,y_1)$. Any Fibonacci-like sequence is periodic $\pmod{p}$, hence there is for sure some $x_n\neq 1$ such that $p\nmid x_n$, since $x_0=1$. However,
$$y_n = \frac{(x_1+y_1\sqrt{d})^n-(x_1-y_1\sqrt{d})^n}{2\sqrt{d}}$$ is always a multiple of $y_1$, hence if $p\mid y_1$, there is no way to find some $y_n$ such that $y_n\not\equiv 0\pmod{p}$.