
Problem 4. Find all pairs $(p, q)$ of prime numbers such that

$$
1+\frac{p^{q}-q^{p}}{p+q}
$$

is a prime number.


Solution. It is clear that $p \neq q$. We set

$$
1+\frac{p^{q}-q^{p}}{p+q}=r
$$

and we have that

$$
p^{q}-q^{p}=(r-1)(p+q)
$$

From Fermat's Little Theorem we have

$$
p^{q}-q^{p} \equiv-q \quad(\bmod p)
$$

Since we also have that

$$
(r-1)(p+q) \equiv-r q-q \quad(\bmod p)
$$

from (3) we get that

$$
r q \equiv 0 \quad(\bmod p) \Rightarrow p \mid q r
$$

hence $p \mid r$, which means that $p=r$. Therefore, (3) takes the form

$$
p^{q}-q^{p}=(p-1)(p+q)
$$

We will prove that $p=2$. Indeed, if $p$ is odd, then from Fermat's Little Theorem we have

$$
p^{q}-q^{p} \equiv p \quad(\bmod q)
$$

and since

$$
(p-1)(p+q) \equiv p(p-1) \quad(\bmod q)
$$

we have

$$
p(p-2) \equiv 0 \quad(\bmod q) \Rightarrow q|p(p-2) \Rightarrow q| p-2 \Rightarrow q \leq p-2n^{2}+n+2$. This means that $q \leq 5$ and the only solution is for $q=5$. Hence the only pair which satisfy the condition is $(p, q)=(2,5)$.

Comment by the PSC. From the problem condition, we get that $p^{q}$ should be bigger than $q^{p}$, which gives

$$
q \ln p>p \ln q \Longleftrightarrow \frac{\ln p}{p}>\frac{\ln q}{q}
$$

The function $\frac{\ln x}{x}$ is decreasing for $x>e$, thus if $p$ and $q$ are odd primes, we obtain $q>p$.

