
2. Find all primes $p$ and $q$ such that $p^{2}+7 p q+q^{2}$ is the square of an integer.


Solution: Let $p, q$ be primes such that $p^{2}+7 p q+q^{2}=m^{2}$ for some positive integer $m$. We write

$$
5 p q=m^{2}-(p+q)^{2}=(m+p+q)(m-p-q)
$$

We can immediately rule out the possibilities $m+p+q=p, m+p+q=q$ and $m+p+q=5$ (In the last case $m>p, m>q$ and $p, q$ are at least 2).

Consider the case $m+p+q=5 p$ and $m-p-q=q$. Eliminating $m$, we obtain $2(p+q)=5 p-q$. It follows that $p=q$. Similarly, $m+p+q=5 q$ and $m-p-q=p$ leads to $p=q$. Finally taking $m+p+q=p q, m-p-q=5$ and eliminating $m$, we obtain $2(p+q)=p q-5$. This can be reduced to $(p-2)(q-2)=9$. Thus $p=q=5$ or $(p, q)=(3,11),(11,3)$. Thus the set of solutions is

$$
\{(p, p): p \text { is a prime }\} \cup\{(3,11),(11,3)\}
$$
