TITLE: When does $(p-1)! + 1 = p^k $ hold?
QUESTION [14 upvotes]: We have a prime $p$ and an integer $k > 0$. When does the following equation stand?
$(p-1)! + 1 = p^k $
I have obviously tried for some little numbers, and in some cases, it stands:
For $ p=2$ and $k=1, 1 + 1 = 2$.
For $ p=3$ and $k=1, 2 +1 = 3.$
For $ p=5$ and $k=2, 24 + 1 = 25.$
Any ideas, how to prove, if there are more, and if yes, what are the solutions?

REPLY [12 votes]: 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$.