To find all $n$ such that $(n-1)!+1$ is a perfect power of $n$

Solution 1:

For $n=2,3,5$ the number $(n-1)!+1$ is a perfect power of $n$, but not for $n=1$ or $n=4$.

Let $n>5$ be such that $(n-1)!+1$ is a perfect power of $n$. If $n$ is composite then $(n-1)!$ is divisible by $n$, so $(n-1)!+1$ cannot be a perfect power of $n$, so $n$ must be prime.

Let $p>5$ be a prime and suppose there exists $k\in\Bbb{Z}$ such that $(p-1)!+1=p^k$. Then $$(p-1)!=p^k-1=(p-1)\cdot\sum_{i=0}^{k-1}p^i,$$ which shows that $(p-2)!=\sum_{i=0}^{k-1}p^i$. We have $$(p-2)!\equiv\sum_{i=0}^{k-1}p^i\equiv k\pmod{p-1},$$ and because $p-1>4$ is composite we have $k\equiv(p-2)!\equiv0\pmod{p-1}$. The inequalities $$p^k-1=(p-1)!<(p-1)^{p-1}<p^{p-1},$$ of integers show that $k<p-1$, and clearly $k>0$, a contradiction.

Therefore $n=2,3,5$ are the only positive integers such that $(n-1)!+1=n^k$ for some $k\in\Bbb{Z}$.