N4. Find all triples of positive integers $(a, b, p)$ with $p$ prime and
$$
a^{p}=b!+p \text {. }
$$
Answer: $(2,2,2)$ and $(3,4,3)$.
Solution 1. Clearly, $a>1$. We consider three cases.
Case 1: We have $ab$ which is also impossible since in this case we have $b!\leqslant a!a>1$.
Case 2: We have $a>p$. In this case $b!-a^{p}-p>p^{p}-p \geqslant p!$ so $b>p$ which means that $a^{p}-b!+p$ is divisible by $p$. Hence, $a$ is divisible by $p$ and $b!-a^{p}-p$ is not divisible by $p^{2}$. This means that $b(2 p-1)!+p \geqslant b!+p$.

Comment. The inequality $p^{2 p}>(2 p-1)!+p$ can be shown e.g. by using
$$
(2 p-1)!=[1 \cdot(2 p-1)] \cdot[2 \cdot(2 p-2)] \cdots \cdots[(p-1)(p+1)] \cdot pp!$ and so $b \geqslant p+1$ which implies that
$$
v_{2}((p+1)!) \leqslant v_{2}(b!)-v_{2}\left(p^{p-1}-1\right) \stackrel{L T E}{ } 2 v_{2}(p-1)+v_{2}(p+1)-1-v_{2}\left(\frac{p-1}{2} \cdot(p-1) \cdot(p+1)\right),
$$
where in the middle we used lifting-the-exponent lemma. On the RHS we have three factors of $(p+1)!$. But, due to $p+1 \geqslant 8$, there are at least 4 even numbers among $1,2, \ldots, p+1$, so this case is not possible.

Solution 2. The cases $a \neq p$ are covered as in solution 1 , as are $p-2,3$. For $p \geqslant 5$ we have $b!-p\left(p^{p-1}-1\right)$. By Zsigmondy's Theorem there exists some prime $q$ that divides $p^{p-1}-1$ but does not divide $p^{k}-1$ for $k(2 p-1)^{p-1} p>p^{p}>p^{p}-p,
$$
a contradiction.
Solution 3. The cases $a \neq p$ are covered as in solution 1, as are $p-2,3$. Also $b>p$, as $p^{p}>p!+p$ for $p>2$. The cases $p-5,7,11$ are also checked manually, so assume $p \geqslant 13$. Let $q \mid p+1$ be an odd prime. By LTE
$$
v_{q}\left(p^{p}-p\right)-v_{q}\left(\left(p^{2}\right)^{\frac{p-1}{2}}-1\right)-v_{q}\left(p^{2}-1\right)+v_{q}\left(\frac{p-1}{2}\right)-v_{q}(p+1) .
$$

But $b \geqslant p+1$, so then $v_{q}(b!)>v_{q}(p+1)$, since $qq^{d-1} \geqslant 2 d
$$
provided $d \geqslant 2$ and $q>3$, or $d \geqslant 3$.
If $q-3, d-2$ and $p \geqslant 13$ then $v_{q}(b!) \geqslant v_{q}(p!) \geqslant v_{q}(13!)-5>2 d$. Either way, $d \leqslant 1$.
If $p>2 q+1$ (so $p>3 q$, as $q \mid p-1$ ) then
$$
v_{q}(b!) \geqslant v_{q}((3 q)!)-3,
$$
so we must have $q \geqslant \frac{p}{2}$, in other words, $p-1-2 q$. This implies that $p-2^{k}-1$ and $q-2^{k-1}-1$ are both prime, but it is not possible to have two consecutive Mersenne primes.

Solution 4. Let $a-p, b>p$ and $p \geqslant 5$ (the remaining cases are dealt with as in solution 3). Modulo $(p+1)^{2}$ it holds that
$$
p^{p}-p-(p+1-1)^{p}-p=\binom{p}{1}(p+1)(-1)^{p-1}+(-1)^{p}-p-p(p+1)-1-p-p^{2}-1 \neq 0 \quad \bmod \left((p+1)^{2}\right) \text {. }
$$

Since $p \geqslant 5$, the numbers 2 and $\frac{p+1}{2}$ are distinct and less than or equal to $p$. Therefore, $p+1 \mid p!$, and so $(p+1)^{2} \mid(p+1)!$.
But $b \geqslant p+1$, so $b!=0 \neq p^{p}-p \bmod (p+1)^{2}$, a contradiction.