Pell equation of the special form I have tried several times to solve the following equation and finally, I was failed to complete. Help me to find the solutions of Pell equation $y^2-2x^2 = p^m$, where $p$ is prime and $8|(p-1)$ or $8|(p+1)$.
A waiting the reply.
 A: Since
$$ (a^2-2b^2)(c^2-2d^2) = (ac-2bd)^2 - 2(bc-ad)^2 $$
it is sufficient to find a solution to $x^2-2y^2 = p$.
Since $p\equiv\pm 1\pmod{8}$, $2$ is a quadratic residue $\pmod{p}$, so there is a natural number $a<\frac{p}{2}$ such that $a^2\equiv 2\pmod{p}$ and
$$ (\heartsuit)\quad a^2-2 = k p,$$
with $k<\frac{p}{4}$. Moreover, every odd prime $q$ that divides $k$ is $\equiv\pm 1\pmod{8}$, because from $(\heartsuit)$ we have that $a$ is a square root of $2\pmod{q}$. We can get rid of the (possible) factor $2$ in $k$: if $k$ is even then $a$ is even too, and:
$$ (a-1)^2 - 2\left(\frac{a}{2}-1\right)^2=\frac{1}{2}\left(a^2-2\right).$$
So we have:
$$ a^2-2b^2 = Qp, $$
where $Q$ is a product of primes of the form $8n\pm1$. Let $q$ be one of them, and
$$ a_q^2-2 = rq, $$
with $r<q/4$. By the initial identity we get:
$$ (a a_q-2b)^2-2(b a_q-a)^2 = rqQp, $$
but both $(a a_q-2b)$ and $(b a_q-a)$ are divisible by $q$, so:
$$ a_*^2 - 2b_*^2 = \left(\frac{a a_q-2b}{q}\right)^2-2\left(\frac{b a_q-a}{q}\right)^2 = r(Q/q)p, $$
and we can get rid of any prime factor in Q, simply starting from the greatest. This proves that any prime of the form $8n\pm1$ is represented by the quadratic form $x^2-2y^2$.
