# When is $(p-2)!-1$ power of $p$ if $p$ is prime?

If $p$ is prime, for what values of $p$ is $(p-2)!-1$ a power of $p$? I know how to solve that when $p<5$ then $(p-1)!+1$ can be written as power of $p$.

• $(p-1)!+1$ is a multiple of $p$, but not a power of $p$ in general. Commented Feb 18, 2016 at 20:48
• @carmichael561 I think the second sentence refers to this question: math.stackexchange.com/questions/287957/…. Commented Feb 18, 2016 at 22:41
• @YogeshGhaturle It seems to me like looking at this modulo $p-1$ (just like in the other question) should help. Can you supply details about what went wrong when you tried this? Commented Feb 18, 2016 at 22:42

More generally: if $n\in\mathbb Z_{\ge 2}$, $k\in\mathbb Z_{\ge 0}$:
then all the solutions of $(n-2)!-1=n^k$ are $(n,k)=(4,0),(5,1)$.
Checking $n\in\{2,3,4,5\}$ gives those solutions. Let $n\ge 6$; then $k\ge 1$.
Clearly $n$ is odd; also $2<\frac{n-1}{2}\le n-2$, so $n-1\mid (n-2)!=n^k+1$.
But also $n-1\mid n^k-1=(n-1)\left(n^{k-1}+n^{k-2}+\cdots+1\right)$.
Therefore $n-1\mid \left(n^k+1\right)-\left(n^k-1\right)=2$, so $n-1\le 2$, contradiction.