Is $n! + 1$ often a prime?

13.6k Views Asked by At

Related to another question (If $n = 51! +1$, then find number of primes among $n+1,n+2,\ldots, n+50$), I wonder: How often is $n!+1$ a prime?

There is a related OEIS sequence A002981, however, nothing is said if the sequence is finite or not. Does anybody know more about it?

3

There are 3 best solutions below

9
On BEST ANSWER

$n! + 1$ is prime for $n = 0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, 320, 340, 399, 427, 872, 1477, 6380, 26951, 110059, 150209, \dots$, no other factorial primes are known as of May 2014. See here for more info on factorial primes.

0
On

Just looking at the heuristics of the problem:

If you pick a random integer $x$, it will be a prime number with a probability about $1 / \ln x$. Now the number $n! + 1$ is not a random integer. We know that $n! + 1$ is not divisible by any prime number $p ≤ n$. A random large integer is not divisible by any prime $p ≤ n$ with probability $(1-1/2)(1-1/3)(1-1/5)...$ which is about $1 / (2 \ln n)$. So the likelihood that $n! + 1$ is a prime is accordingly higher, about $2 \ln n / \ln (n!)$.

Using the Stirling formula, $\ln (n!)$ is about $n \ln n - n$ or $n(\ln n - 1)$. So $n!+1$ is prime with probability about $(2/n)/(1 - 1 / \ln n)$.

The factor $(1 - 1 / \ln n)$ is quite close to 1; the number of primes of the form $n! + 1$ with $n ≤ M$ is about $2 \ln M$. Very roughly agrees with the list of primes given earlier (I think it is a list of known primes, with many numbers in between not examined).

0
On

Such numbers are called factorial primes. There is only a limited number of known such numbers.

The largest factorial primes were discovered only recently. From an announcement of an organization called PrimeGrid PRPNet:

On 30 August 2013, PrimeGrid’s PRPNet found the 2nd largest known Factorial prime: $$147855!-1$$ The prime is $700,177$ digits long. The discovery was made by Pietari Snow (Lumiukko) of Finland using an Intel(R) Core(TM) i7 CPU 940 @ 2.93GHz with 6 GB RAM running Linux. This computer took just a little over 69 hours and 37 minutes to complete the primality test.

PrimeGrid is a set of projects based on distributed computing, and devoted to finding primes satisfying various conditions.

Factorial primes-related recent events in PrimeGrid:

$147855!-1$ found: official announcement

$110059!+1$ found: official announcement

$103040!-1$ found: official announcement

$94550!-1$ found: official announcement

Other current PrimeGrid activities:

  • 321 Prime Search: searching for mega primes of the form $3·2^n±1$.
  • Cullen-Woodall Search: searching for mega primes of forms $n·2^n+1$ and $n·2^n−1$.
  • Extended Sierpinski Problem: helping solve the Extended Sierpinski Problem.
  • Generalized Fermat Prime Search: searching for megaprimes of the form $b2^n+1$.
  • Prime Sierpinski Project: helping solve the Prime Sierpinski Problem.
  • Proth Prime Search: searching for primes of the form $k·2^n+1$.
  • Seventeen or Bust: helping to solve the Sierpinski Problem.
  • Sierpinski/Riesel Base 5: helping to solve the Sierpinski/Riesel Base 5 Problem.
  • Sophie Germain Prime Search: searching for primes $p$ and $2p+1$.
  • The Riesel problem: helping to solve the Riesel Problem.