# How prove this $p\equiv 1\pmod 8$

let $m,n$ are positive integer numbers,and such $m<n$,if

$$p=\dfrac{n^2+m^2}{\sqrt{n^2-m^2}}$$ is prime number.

show that $$p\equiv 1 \pmod 8$$

My try: let $$p=\dfrac{n^2+m^2}{\sqrt{n^2-m^2}}=\dfrac{n^2-m^2+2m^2}{\sqrt{n^2-m^2}}=\sqrt{n^2-m^2}+\dfrac{2m^2}{\sqrt{n^2-m^2}}$$ Then I can't

-

If $p$ divided either of $n$ and $m$, then it must also divide the other, so dividing by $p$ yields (with $n = p\nu,\, m = p\mu$)

$$1 = \frac{\nu^2 + \mu^2}{\sqrt{\nu^2-\mu^2}},$$

from which it follows that $\nu = 1,\, \mu = 0$ contradicting the positivity of $n$ and $m$. So $p$ divides neither $n$ nor $m$.

Now, for

$$\frac{n^2+m^2}{\sqrt{n^2-m^2}}$$

to be an integer, we must have

$$n^2 - m^2 = k^2,$$

and hence

$$n^2 + m^2 = k^2 + 2m^2.$$

$p = 2$ is impossible, since $\dfrac{n^2+m^2}{\sqrt{n^2-m^2}} > \sqrt{n^2+m^2}$, which would force $n = m = 1$ to have $\sqrt{n^2+m^2} < 2$. So $p$ is an odd prime.

$p \mid n^2 + m^2$ implies that $-1$ is a quadratic residue modulo $p$, so $p \equiv 1 \pmod{4}$.

$p \mid k^2 + 2m^2$ implies that $-2$ is a quadratic residue modulo $p$, so $p \equiv 1 \pmod{8}$ or $p \equiv 3 \pmod{8}$. Since we have $p \equiv 1 \pmod{4}$ from above, it follows that $p \equiv 1 \pmod{8}$.

-