The question was stimulated by this one. Here it comes:

When you look at the sum $\sum\limits_{k=1}^N k!$ for $N\geq 10$, you'll always find $3$ and $11$ among the prime factors, due to the fact that $$ \sum\limits_{k=1}^{10}k!=3^2\times 11\times 40787. $$ Increasing $N$ will give rise to factors $3$ resp. $11$.

Are $3$ and $11$ the only common prime factors in $\sum\limits_{k=1}^N k!$ for $N\geq 10$?

I think, one has to show, that $\sum\limits_{k=1}^{N}k!$ has a factor of $N+1$, because the upcoming sum will always share the $N+1$ factor as well. This happens for $$ \underbrace{1!+2!}_{\color{blue}{3}}+\color{blue}{3}! \text{ and } \underbrace{1!+2!+\cdots+10!}_{3^2\times \color{red}{11}\times 40787}+\color{red}{11}! $$

  • 8
    $\begingroup$ Let $a_p = \sum_{k=1}^p k!$. If we assume that $a_p \equiv 0 \mod p$ with "probability" $1/p$, then the expected number of times this happens for $p<N$ is $\log \log N$. This quantity is not larger then $3$ until $N$ is about 500,000,000. So the fact that you have only found two examples with a short search does not convince me that there are no more. $\endgroup$ Commented Mar 8, 2012 at 16:18
  • 2
    $\begingroup$ By the way, I just checked up to the 500th prime, 3571, without finding another example. $\endgroup$ Commented Mar 8, 2012 at 16:20
  • 4
    $\begingroup$ Checked for other examples for primes up to 15000000; none found. $\endgroup$ Commented Dec 29, 2012 at 22:27
  • 3
    $\begingroup$ There is really little known about the distribution of factorials modulo a prime $p$. For instance, it is conjectured that the sequence $(n!)$ attains $\approx (1-\frac{1}{e})p$ residues modulo $p$ and it is known unconditionally that it is at least $$\frac{p\log\log p}{\log\log\log p}.$$ However, this does not help for your question. If I should guess an answer, I'd bet (given the "random" behaviour of the primes) that there are infinitely many primes $p$ such that $p\mid 1!+2!+\cdots+(p-1)!$. $\endgroup$ Commented Feb 26, 2018 at 16:48
  • 1
    $\begingroup$ It might be a good idea to make the problem statement unambiguous by explicitly pointing out you're looking for prime factors $p$ shared by all the sums with $N\geq (p-1)$, rather than using $N\geq 10$ (which would make the question trivial). $\endgroup$ Commented Feb 26, 2018 at 19:41

1 Answer 1


As pointed out in the comments, the case is trivial( at least if you know some theorems) if you fix $n>10$, instead of $n>p-1$ for prime $p$.

It follows from Wilson's Theorem, that if you have a multiple of $p$ at index $n= p-2$ you won't at index $p-1$ because it will decrease out of being one for that index. $p>12$ implies at least $1$ index where it is NOT a multiple if it worked at index $11$. That leaves us with $p<12$ which would have to be factors of the sum up to $p-1$, $2$ is out as the sum is odd, $5$, needs $24+1+2+6=33$ to be a multiple of $5$, it isn't. Lastly $7$ needs $1+2+6+24+120+720=873$ to be a multiple which would force $33$ to be a multiple of $7$ which it isn't.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .