Prove that given a prime $p$ at least one of the following equations have a solution:
$x^2+2y^2=p$, $x^2+2y^2=2p$.
The hint is “consider the pairs $(u, v)$ in $u+av$ where $a$ satisfies $p|a^2+2$.
Since the textbook has not reach the ring extension of $\mathbb{Z}$ nor any other theorems except for the Wilson’s theorem and Euler’s theorem, please try to use elementary method if possible.
The problem is in section $2.1$ #$56$, in the book An Introduction to the Theory of Numbers by Ivan Niven, Herbert S. Zuckerman, Hugh L. Montgomery.
I tried to prove the existence of solution nonconstructive, just as we prove that there are irrational pairs $(a,b)$ such that $a^b$ is rational. I also tried to follow the hint but I failed to understand what the hint really says.