TITLE: Solutions to $p+1=2n^2$ and $p^2+1=2m^2$ in Natural numbers.
QUESTION [9 upvotes]: $$p+1=2n^2$$$$p^2+1=2m^2$$ Find positive integers $m,n$ and prime $p$ satisfying the above two equations.

What would people commonly do?
Subtracting both the equations.
You get: 
$$p(p-1)=2(m-n)(m+n)$$
If you notice carefully, the above equation has infinitely many solutions, and this doesn't work because the generality of the equation is lost when you subtract both of them.
I noticed that $p \equiv -1 \pmod 8$. $p=7$ works fine. I don't see any other solution, but not able to contradict of existence.

REPLY [5 votes]: Here's Mahoney's proof [p.338].
Let $(u_0,w_0)$ be a solution of $$2U^2-W^2=p. \tag{1}$$ Then
$$(u_1,w_1) = (2u_0^2 \pm 2u_0w_0 + w_0^2,2u_0^2\pm 4u_0w_0 + w_0^2)$$
is a solution of $2U^2-W^2=p^2.\tag{2}$ If, moreover, $(u_0,w_0)$ is the least solution of (1), then $(u_1,w_1)$ with the minus sign is the least solution of (2). Therefore suppose $2u_0^2-1=p$. Then $$(u_1,w_1)=(2u_0^2-2u_0+1,2u_0^2-4u_0+1)\tag{$\star$}$$ is a solution of (2). But clearly $(u_0,1)$ is the least solution of (1); hence $(\star)$ gives the least solution of (2). By assumption, we have $w_1 = 1 = 2u_0^2-4u_0+1$, so $u_0=2$, and $(2,1)$ is the only solution of (1). Hence $p=7$.