Find all natural numbers $n$ and $m$ for which $$n^m=(n-1)!+1.$$

By the Wilson theorem, $n$ is prime. Obviously, $m < n$.

For example, some solutions $(n, m)$ are $(2, 1)$, $(3, 1)$ and $(5, 2)$.

  • 1
    $\begingroup$ If $n > 4$, then $(n-1)|(n-2)!=\frac{n^m-1}{n-1}=1+n+\ldots+n^{m-1}$. $\endgroup$ – Mindlack Feb 20 at 17:25
  • 1
    $\begingroup$ $1^1\ne 0!+1$? So $(1,1)$ is not a solution. $\endgroup$ – Peter Foreman Feb 20 at 17:26
  • $\begingroup$ @PeterForeman, I fixed, thank you. $\endgroup$ – Anastasia K. Feb 20 at 17:32

You have found all the solutions.

Suppose there is a solution with $n>5.$ As you have noted, by Wilson's theorem, $n$ is prime. We have $$n^m-1=(n-1)!,$$ and dividing both sides by $n-1,$ $$(n-2)!=1+n+\cdots+n^{m-1}\tag{1}$$ Since $n>5$ is prime, $n-1$ is composite and $(n-1)|(n-2)!$ (Prove this.)

The preceding is Mindlack's hint, but I gather you haven't seen where to go from there.

Reducing both sides of $(1)$ modulo $n-1$ gives $0\equiv m\pmod{n-1}.$ Since $n-1$ divides $m$, we have $m\ge n-1.$

Now argue that $n^{n-1}>1+(n-1)!$

  • $\begingroup$ Not getting how $1+n+\cdots +n^{m-1}\equiv m\pmod{n-1}$! Probably missing something trivial.. $\endgroup$ – tarit goswami Mar 29 at 16:40
  • 1
    $\begingroup$ @tarit There are $m$ terms, each of which is congruent to $1$ mod $n-1$ $\endgroup$ – saulspatz Mar 29 at 16:43
  • $\begingroup$ Oops. Nice solution, can you share how you think what is necessary while solving a particular problem?,e.g; this one $\endgroup$ – tarit goswami Mar 29 at 16:52
  • $\begingroup$ @taritgoswami I wish I could. Actually, this problem appears in Tom Apostol's undergraduate Analytic Number Theory book. Many years ago, somebody showed me how to do it after I failed to solve it by myself. I was sure I'd found all the solutions, and that the exponent would be too big for there to be others. I think the key technique is to realize that you have to start by assuming $n$ is somewhat large, since we know there are some solutions. Examine closely how the argument uses $n>5.$ $\endgroup$ – saulspatz Mar 29 at 17:01
  • $\begingroup$ Thanks for sharing :) $\endgroup$ – tarit goswami Mar 29 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.