Find $a \in \mathbb N$ such that $x^2+ax-1 = y^2$ has a solution in positive integers Question: Find all the positive integers $a$ such that $x^2+ax-1 = y^2$ has a solution in positive integers $(x,y)$.
Comments: It's easy to see that this equation rarely has a solution (in the sense that for a fixed $a$, $x^2+ax-1$ is a perfect square only for finitely many values of $x$). In fact, if $a$ is even then $x^2 \le x^2+ax-1 < (x+a/2)^2$, so $x^2+ax-1$ is almost never a perfect square. The problem is that I can't control the interval $[x^2,(x+a/2)^2)$ when $a$ grows. There's a similar argument for $a$ odd.
However, it is possible to find some families of such $a$'s. For instance, if $a$ is a perfect square, say $a=k^2$, then there exists the solution $(x,y) = (1,k)$.
In addition, if $x > 1$ then its prime power factors are $2$ and/or $p^\alpha$, where $p \equiv 1 \pmod 4$. In fact, if $p|x$ then the constraint of the equation modulo $p$ yields that $-1$ is a square.

Actually, every $a$ that is not $2 \pmod 4$ yields a solution.  These $a$ are impossible because then
$$x^2 + ax - 1 \equiv x^2 + 2x - 1 \equiv (x - 1)^2 - 2 \pmod 4,$$
which is either $2$ or $3$ mod $4$, but squares are only $0$ or $1$ mod $4$.
For the other $a$, I will construct values of $x$ that work.
For $a = 4k$, take $x = 2k^2 - 2k + 1 = \frac{(2k - 1)^2 + 1}{2}$.  Then
\begin{align*}
x^2 + ax - 1 &= (2k^2 - 2k + 1)^2 + 4k(2k^2 - 2k + 1) - 1\\
             &= (4k^4 - 8k^3 + 8k^3 - 4k + 1) + (8k^3 - 8k^2 + 4k) - 1\\
             &= 4k^4\\
             &= (2k^2)^2
\end{align*}
For $a = 4k + 1$, take $x = 4k^2 + 1$.  Then
\begin{align*}
x^2 + ax - 1 &= (4k^2 + 1)^2 + (4k + 1)(4k^2 + 1) - 1\\
             &= (16k^4 + 8k^2 + 1) + (16k^3 + 4k^2 + 4k + 1) - 1\\
             &= 16k^4 + 16k^3 + 12k^2 + 4k + 1\\
             &= (4k^2 + 2k + 1)^2
\end{align*}
For $a = 4k + 3$, take $x = 4k^2 + 4k + 2$.  Then
\begin{align*}
x^2 + ax - 1 &= (4k^2 + 4k + 2)^2 + (4k + 3)(4k^2 + 4k + 2) - 1\\
             &= (16k^4 + 32k^3 + 32k^2 + 16k + 4) + (16k^3 + 28k^2 + 20k + 6) - 1\\
             &= 16k^4 + 48k^3 + 60k^2 + 36k + 9\\
             &= (4k^2 + 6k + 3)^2
\end{align*}
