# Can anyone solve this Pell equation?

I have solved the Pell equation $$p^2 - 95 q^2 =1$$ . By looking at the convergents corresponding to the simple continued fraction of $$\sqrt{95}$$ I was able to find the fundamental solution $$p=39$$ and $$q=4$$ . I found the five smallest pairs of positive integers $$p,q$$ that satisfy the above Pell equation. They are : \begin{align*} p=39 \quad& q=4 \\ p=3041 \quad&q=312\\ p=237159 \quad& q=24332 \\ p=18495361\quad& q=1897584 \\ p=1442400999 \quad& q=147987220 \end{align*}

However I am having difficulty solving the related Pell equation $$p^2 - 95 q^2 =-1 , +1 , -1 , +1 , -1 , +1 , .....$$

The only difference now is that the right hand side of the equation is alternatively $$-1$$ and $$+1$$ , instead of just $$+1$$. One obvious trivial solution is $$p=1$$ and $$q=0$$ , or $$p= \sqrt{-1}$$ and $$q=0$$ but these trivial solutions do not count.

I am trying to find the five smallest pairs of positive integers $$p,q$$ that satisfy this equation. I would appreciate your help.

• Take remainders $\mod 4$, you need $p^2+q^2\equiv3\pmod4$ – Empy2 Jul 17 '20 at 10:52

There are no solutions to $$p^2-95q^2=-1$$, because they would imply $$p^2\equiv-1\bmod95$$, which would imply $$p^2\equiv-1\bmod19$$, and there are no solutions to $$p^2\equiv-1\bmod19$$, because there are no solutions to $$p^2\equiv-1\bmod n$$ for prime $$n\equiv-1\bmod4.$$
Given $$D \,\in \,\mathbb{Z^+},$$ where $$D$$ is not a perfect square, let
$$[a_0; \overline{a_1, a_2, \cdots, a_{n-1}, 2a_0}]$$ represent the representation of
$$\sqrt{D}$$ as a (simple) continued fraction.
This means that the length of the period of this representation is $$n.$$
Then, it is well settled that if $$n$$ is even
then the Diophantine equation $$x^2 - Dy^2 = -1$$ will have no positive integer solutions.