When does $(p-1)! + 1 = p^k $ hold? [duplicate]

Solution 1:

We show there cannot be any solutions for $p\gt 5$ $$(p-1)!+1 = p^k \implies (p-1)! = p^k-1 = (p-1)\sum\limits_{i=0}^{k-1}p^i$$

Cancel $p-1$ both sides and get $$(p-2)! = \sum\limits_{i=0}^{k-1}p^i$$

Notice that left hand side is divisible by $p-1$ for $p\gt 5$ $$\begin{align}0&\equiv \sum\limits_{i=0}^{k-1}p^i \pmod{p-1}\\0&\equiv \sum\limits_{i=0}^{k-1}1 \pmod{p-1}\\0&\equiv k \pmod{p-1}\\k&=t(p-1)\end{align}$$

So we need $k$ to be of form $t(p-1)$

$$(p-1)! + 1 = p^{t(p-1)}$$

Clearly this is impossible because $(p-1)! + 1 \lt p\cdot p\cdots (\text{p-1 times}) = p^{p-1}$

That proves there are no solutions for $p\gt 5$.