I know x^2 ≡ -2 (mod p) means that p|(x^2 -2), but I can't figure out how to continue with this.
Any help is appreciated!
[also under discussion in math links forum]
by Dirichlet's approximation theorem there exist integers $\displaystyle 1 \leq k \leq \lfloor \sqrt{p} \rfloor$ and $\displaystyle m$ such that $\displaystyle |\frac{kx}{p} - m| \leq \frac{1}{\lfloor \sqrt{p} \rfloor + 1} < \frac{1}{\sqrt{p}}.$ which gives us $\displaystyle |kx - mp| < \sqrt{p}.$
now put $\displaystyle a=|kx - mp|$ and $\displaystyle b=k$ and show that $\displaystyle p \mid a^2 + 2b^2$ and $\displaystyle 0 < a^2 + 2b^2 < 3p.$