Find all $n\in\mathbb N$ such that $\sqrt{n^2+8n-5}$ is an integer. $n^2+8n-5$ has to be a perfect square.
How to find all $n$?
 A: $y^2=n^2+8n-5 = (n+4)^2 - 21$ implies $21 = x^2-y^2$, for $x=n+4$.
Write $21 = x^2-y^2= (x-y)(x+y)$. Since $x=n+4 \ge 4$, we must have $x+y=7$ or $x+y=21$.


*

*$x+y=7$ implies $x-y=3$ and so $x=5$ and $n=1$

*$x+y=21$ implies $x-y=1$ and so $x=11$ and $n=7$
A: Note that $n^2 + 8x - 5 = (n + 4)^2 - 21$. Now this number will certainly be no square if it is bigger than $(n + 3)^2$ (since there are no squares strictly between $(n + 3)^2$ and $(n + 4)^2$), i.e. if
$$\begin{align*}
&n^2 + 8n - 5 > (n + 3)^2 \\
\iff& n^2 + 8n - 5 > n^2 + 6n + 9 \\
\iff& 2n > 14 \\
\iff& n > 7
\end{align*}$$
So we know that $n^2 + 8n - 5$ is no square if $n$ is greater than $7$. But this leaves only $n = 1, 2, \ldots, 7$ to check manually. This shows that $n = 1$ and $n = 7$ are the only numbers for which $n^2 + 8n - 5$ is a square.
A: Suppose that
$$
n^2+8n-5=m^2\tag{1}
$$
Then
$$
8n-5=(m-n)(m+n)\tag{2}
$$
If $m-n\ge4$, then we have $8n-5\ge4(2n+4)=8n+16$. Thus, $k=m-n\lt4$. It is also obvious that $k=m-n$ must be odd (since $8n-5$ is odd).
$$
8n-5=k(2n+k)=2kn+k^2\tag{3}
$$
Thus
$$
n=\frac{k^2+5}{8-2k}\tag{4}
$$
Plugging $k=1$ and $k=3$ into $(4)$ gives
$$
n=1\quad\text{or}\quad n=7\tag{5}
$$
