2. Find all pairs of prime numbers $p$ and $q$ for which the numbers $p+q$ and $p+4q$ are perfect squares.
II/2. Let $p+q=x^{2}$ and $p+4 q=y^{2}$ for some natural numbers $x$ and $y$. If we subtract the equations, we get $3 q=y^{2}-x^{2}=(y-x)(y+x)$. Since $q$ is a prime number and $x+y \geq 2$, we have the following possibilities:

(a) possibility: $y-x=1$ and $y+x=3 q$. From the first equation, we express $y=x+1$ and substitute it into the second, to get $2 x+1=3 q$. From this, it follows that $q$ is an odd number, so we can write $q=2 m+1$ for some natural number $m$. Then $x=3 m+1$ and $p=x^{2}-q=9 m^{2}+4 m=m(9 m+4)$. Since $p$ is a prime number, $m$ must be 1. Thus, we get $p=13$ and $q=3$, which are indeed prime numbers.
(b) possibility: $y-x=3$ and $y+x=q$. From the first equation, we express $y=x+3$ and substitute it into the second, to get $2 x+3=q$. From the initial equation, we then get $p=x^{2}-q=x^{2}-q=x^{2}-2 x-3=(x+1)(x-3)$. Since $p$ is a prime number, $x$ must be 4. Thus, we get $p=5$ and $q=11$, which are indeed prime numbers.
(c) possibility: $y-x=q$ and $y+x=3$. Since $x$ and $y$ are natural numbers and $y>x$, we have $y=2$ and $x=1$, which gives us a contradiction $q=1$.

The solutions to the equation are therefore the pairs $(5,11)$ and $(13,3)$.

![](https://cdn.mathpix.com/cropped/2024_06_07_2324ea98e20bf8c655d1g-11.jpg?height=365&width=1650&top_left_y=934&top_left_x=206)

The conclusion that there are 4 possibilities is the most important conclusion, so partial points were not given for writing only some of the possibilities.