4. In the set of prime numbers, solve the equation

$$
p^{2}+p q+q^{2}=r^{2}
$$
Solution. It is obvious that $r>p$ and $r>q$. We rewrite the equation in the form $(p+q)^{2}-p q=r^{2}$, from which it follows that

$$
(p+q-r)(p+q+r)=p q
$$

Clearly,

$$
p+q-r<p+q+r, \quad p+q-r<p \text { and } p+q-r<q
$$

from which we obtain that $p, q$ are not divisors of $p+q-r$, so it follows that

$$
p+q-r=1, p+q+r=p q
$$

By adding the last two equations, we get

$$
2 p+2 q=p q+1 \text { or }(p-2)(q-2)=3
$$

From the last equation, we get $p=3, q=5$ or $p=5, q=3$. In both cases, $r=7$.

Finally, $(p, q, r) \in\{(3,5,7),(5,3,7)\}$.

## Second Year