Find all $n,k \in \Bbb N^+$ such that $(n-1)!=n^k-1$

Using $n^k-1=(n-1)(1+n^2+...+n^{k-1})$ and cancelling $(n-1)$ in each side, we get that $$(n-2)!|1+n^2+...+n^{k-1}$$ So, let's suppose $n$ is an even number, in $(1+n^2+...+n^{k-1})$ we have $k$ terms, where $k-1$ are even ($n^i$ for $i>0$) and one is odd ($1$), so we have that $1+n^2+...+n^{k-1}$ is odd. Also, if $n$ is even, then $n-2$ has the same parity so n-2 is even; therefore, if $n-2>0$ then $(n-2)!$ is even and that is a contradiction. So with this, when n is an even number, the only solution is $n=2, k=1$ Now, in every other solution, $n$ is odd.

Let's suppose $k=1$. we have $(n-2)!=1$ (for $n, n-2$ odd) and it follows $n=3, k=1$.

Using this, if $n$ is odd, then $n^x$ is odd too, so it follows that we have $k$ odd terms, so if $k$ is even, then $(1+n^2+...+n^{k-1})$ is even, since every pair of terms sums an even number. From $n=4$ onwards, $(n-2)!$ is even so k has to be even too.

Let's suppose $k=2$. Then $$(n-2)!|n^2+1$$ $n=5$ works and let's prove is the only solution. Supose there is a $n=5+m$ for $m>0$. So: $$(m+3)!|m+6$$ And it's not hard to prove that $(m+3)!>m+6$ if $m$ is not $0$

So I got stuck here, I could only find these 3 solutions, and I don't know how to prove that there aren't more, since, for more bigger values it seems that $(n-2)!$ is greater if $k<n-1$. Would appreciate any help on the proof, or hints. thanks.

  • 4
    $\begingroup$ Let $p$ be a prime factor of $n$. Since $p$ does not divide $n^k-1$, $p$ does not divide $(n-1)!$, so $p \geq n$. So $n$ is prime. If $n$ is prime, by Euler theorem there is $\omega_n > 0$ such that $(n-1)!|n^k-1$ iff $\omega_n|k$. $\endgroup$
    – Aphelli
    Sep 11, 2019 at 21:56
  • $\begingroup$ SonodaUmi, I found (n=3, ∀k ∈N),(n=4, k=5 ), (k=6, has no solution for k), (n=7, k must be found by brute force). I concluded that there are always solutions for any n except those their last digit is 6 or 8. $\endgroup$
    – sirous
    Sep 12, 2019 at 19:24
  • $\begingroup$ I'm sorry, i had an error on the title. I'll correct it now $\endgroup$
    – SonodaUmi
    Sep 12, 2019 at 22:28
  • $\begingroup$ It was suposed to be equal, not only divisible, sorry $\endgroup$
    – SonodaUmi
    Sep 12, 2019 at 22:30
  • $\begingroup$ Where does this problem come from? $\endgroup$
    – YiFan
    Sep 13, 2019 at 2:51