6. Find all such prime numbers $p$ and $q$ that $p^{q+1}+q^{p+1}$ is a square of a natural number.
Answer: $p=q=2$

Solution. It is clear that $p=q=2$ works. Let $p$ be odd and $p^{q+1}+q^{p+1}=n^{2}$. Then

$$
p=2 k-1 \quad \text { and } \quad p^{q+1}=n^{2}-q^{2 k}=\left(n-q^{k}\right)\left(n+q^{k}\right) .
$$

Let the greatest common divisor of the numbers $n-q^{k}$ and $n+q^{k}$ be denoted by $d$. Then $d$ is a power of $p$ and the number $2 q^{k}=\left(n+q^{k}\right)-\left(n-q^{k}\right)$ is divisible by $d$. Since $p$ is odd, it follows that either $d=1$ or $p=q$. In the latter case, $n^{2}=p^{q+1}+q^{p+1}=2 p^{p+1}$, which is impossible since $p$ is odd. Therefore, $d=1$. The factors $n-q^{k}$ and $n+q^{k}$ are powers of $p$, so $n-q^{k}=1$ and $n+q^{k}=p^{q+1}$. Thus, $2 q^{k}=p^{q+1}-1$. If $q$ is odd, the left side gives a remainder of 2 when divided by four, while the right side is divisible by four. Therefore, $q=2$ and, hence,

$$
2^{k+1}=p^{3}-1=(p-1)\left(p^{2}+p+1\right)=2 k\left(4 k^{2}-2 k+1\right)
$$

Therefore, $k=2^{m}$ and $2^{\ell}=4 k^{2}-2 k+1=2^{2 m+2}-2^{m+1}+1$. The last equality is impossible, because the number $2^{2 m+2}-2^{m+1}+1$ is greater than one and odd, and thus cannot be a power of two.