Q:

A diophantine equation

I want to understand why the equation $U^2-(m^2-4)V^2=-4$ (when $U,V,m$ are odd number and $m > 3$)  is impossible. (This came from a post I was reading here)

A:

Let $D=m^2-4$ with $m\ge 5$ odd. If there is an odd solution $(u,v)$ to $u^2-Dv^2=-4$, then $(x,y)=(\frac{(u^2+3)u}{2}, (\frac{(u^2+1)v}{2})$ is a solution to $x^2-Dy^2=-1$. Hence it is enough to show that the latter negative Pell equation has no solution for $D=m^2-4$ with $m\ge 5$ odd. It is well known that $x^2-Dy^2=-1$ is solvable in integers $x,y$ if and only if $\ell(\sqrt{D})$ is odd. Here $\ell(\sqrt{D})$ is the length of the continued fraction of the quadratic irrational $\sqrt{D}$. But, with $m=n+1$, $n>3$ even, we have
$$
\sqrt{D}=\sqrt{n^2+2n-3}=[n;\overline{1,\frac{n-2}{2},2,\frac{n-2}{2},1,2n}],
$$
as an easy calculation shows. Hence $\ell(\sqrt{D})=6$ is even, and there is no integer solution. Note that for $n=2$ this is not true, and there is a solution of $x^2-5y^2=-1$, namely $(x,y)=(2,1)$. Then $U^2-5V^2=-4$ also has a solution, namely $(U,V)=(1,1)$.
Edit: This is a corrected answer, the comments refer to an earlier version, which was not complete.

