# Solving a little Diophantine equation:$(n-1)!+1=n^m$ [duplicate]

How can I solve this Diophantine equation: $$(n-1)!+1=n^m$$ with $n,m$ positive integers?

From Wilson's theorem we can note that $n$ is a prime number. I proved to rewriting the equation as:$$(n-2)!=n^{m-1}+n^{m-2}+....+1$$ but in vain. I proved to solve also through the theorem LTE bur I analysed only some cases without obtain a general solution.

• Aug 29, 2017 at 19:44

If $1\le n\le 5$, then $(n,m)=(2,1),(3,1),(5,2)$. Let $n\ge 6$.

$$(n-1)!+1=n^m$$

$$\iff (n-2)!=\frac{n^m-1}{n-1}=$$

$$=1+n+n^2+\cdots+n^{m-2}+n^{m-1}$$

$$\iff (n-2)!-m=$$

$$=(1-1)+(n-1)+(n^2-1)+\cdots+(n^{m-1}-1)$$

$2$, $\frac{n-1}{2}$ are different and $\le n-2$, so

$2\cdot \frac{n-1}{2}=n-1\mid (n-2)!$.

For all $a,b\in\mathbb R$, $k\ge 2$, $k\in\mathbb Z$, $$a^k-b^k=(a-b)(a^{k-1}b^0+a^{k-2}b^1+\cdots+a^0b^{k-1})$$

If $k$ is odd, $c=-b$, then

$$a^k+c^k=(a+c)(a^{k-1}c^{0}-a^{k-2}c^1+\cdots+a^0c^{k-1})$$

Let $a=n$, $b=1$. Then $n-1\mid n^k-1$ for all $k\ge 0$, $k\in\mathbb Z$ because $n-1\mid n^0-1=1-1=0$ and $n-1\mid n^1-1=n-1$.

$n-1\mid m$, so $m\ge n-1$ (because $m>0$) and $$n^m = (n-1)! + 1 = 1 \cdot 2 \cdots (n-1) + 1 <$$

$$<\underbrace{(n-1)(n-1)\cdots (n-1)}_{\text{n-1 times}}=$$

$$= (n-1)^{n-1} < n^{n-1},$$

contradiction. Answer: $(n,m)=(2,1),(3,1),(5,2)$.