Find all primes $p$ for which there exist positive integers $x, y$ such that $p+1=2x^2$ and $p^2+1=2y^2$.
I have tried coming up with an equation for $p$ or $p^2$ and this is what I've got
$p=2x^2-1$;
$p^2=(2x^2-1)^2$
$p^2=2y^2-1$
which means $(2x^2-1)^2=2y^2-1$ but this doesn't do much...