Are there any integer solutions to $x^2 - (n^2 - 2)y^2 = -1$? I was just wondering if there are any integer solutions to the Diophantine equation: 
$x^2 - (n^2 - 2)y^2 = -1 \ \ $  for $n > 2$
I don't think there are any but can't prove why.
 A: Note that if $d$ is divisible by a prime $p$ of the form $4k+3$, then the equation $x^2-dy^2\equiv -1$ cannot have a solution, for $x^2\equiv -1\pmod{p}$ does not have a solution.
If $n>2$ is odd, then $n^2-2\equiv -1\pmod{4}$, so $n^2-2$ is divisible by a prime of the form $4k+3$.
If $n$ is divisible by $4$, then again $n^2-2$ is divisible by a prime of the form $4k+3$.  But this leaves the possibility $n\equiv 2\pmod{4}$, where $n^2-2$ need not have a prime divisor of the form $4k+3$. 
Remark: Will Jagy has settled the problem in general, by observing that the continued fraction of $\sqrt{n^2-2}$ has period $4$. (If $\sqrt{d}$ has continued fraction with even period, then the equation $x^2-dy^2=-1$ has no integer solutions.)  
There is an approach that does not use properties of continued fractions, but instead uses basic properties of Pell equations.  Note that $x=n^2-1$, $y=n$ is a solution of the Pell equation $x^2-(n^2-2)y^2=1$. If there were solutions of  $x^2-(n^2-2)y^2=-1$, there would be a fundamental solution $(a_0,b_0)$, and $(n^2-1,n)$  would be an "even power" of $(a_0,b_0)$, in the sense that 
$n^2-1+n\sqrt{n^2-2}=(a_0+b_0\sqrt{n^2-2})^{2k}$ for some positive integer $k$. This is not possible, for if $(a_0+b_0\sqrt{n^2-2})^{2k}=a+b\sqrt{n^2-2}$, then $a \ge n^2-1$, and we cannot have equality.  
A: This can be a form of Pell's equation if $\,n^2-2\,$ is not a square, and it always has non-trivial solutions with $\,y>0\,$ by a theorem of Lagrange.
