How to find all positive integers $n$ such that $(n-1)!+1$ can be written as $n^k$ for some positive integer $k$?


1 Answer 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}$.

  • 1
    $\begingroup$ What is the use of $k'$. It seems you can get $0\equiv k\pmod{p-1}$ directly from $(p-2)!=\sum_{i=0}^{k-1}p^i$. $\endgroup$
    – xskxzr
    May 22, 2018 at 12:27
  • $\begingroup$ In addition, it seems $(p-1)^{p-1}<p^{p-1}$ is needless. $k<p-1$ can be derived from $p^k-1<(p-1)^{p-1}$, but cannot from $p^k-1<p^{p-1}$. $\endgroup$
    – xskxzr
    May 22, 2018 at 12:48

You must log in to answer this question.