2. Find all primes $p$ for which the numbers $p+1$ and $p^{2}+1$ are double the squares of natural numbers.

#
# Answer: $p=7$

First solution. Let $p+1=2 x^{2}$ and $p^{2}+1=2 y^{2}$, then $2\left(y^{2}-x^{2}\right)=p(p-1)$. Therefore, either $y-x$ or $y+x$ is divisible by $p$. From the inequality $xy-x \geqslant p$ and, thus, $2(y-x)(y+x) \geqslant 2 p^{2}>p(p-1)$, which is impossible. Therefore, $y+x$ is divisible by $p$. Note that $\frac{y^{2}}{x^{2}}=\frac{p^{2}+1}{p+1}>\frac{p^{2}-1}{p+1}=p-1$. Then if $p \geqslant 11$, $y^{2}>12 x^{2}$, hence $y>3 x$ and, thus, $2(y-x)>y+x \geqslant p$. Therefore, $2(y-x)(y+x)>p^{2}>p(p+1)$, which is also impossible. Thus, it remains to consider the cases $p=3, p=5$, and $p=7$. In the first two cases, $p+1$ is not a doubled square, while $p=7$ fits.