

A002981


Numbers k such that k! + 1 is prime.
(Formerly M0908)


112



0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, 320, 340, 399, 427, 872, 1477, 6380, 26951, 110059, 150209, 288465
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

If n + 1 is prime then (by Wilson's theorem) n + 1 divides n! + 1. Thus for n > 2 if n + 1 is prime n is not in the sequence.  Farideh Firoozbakht, Aug 22 2003
For n > 2, n! + 1 is prime <==> nextprime((n+1)!) > (n+1)nextprime(n!) and we can conjecture that for n > 2 if n! + 1 is prime then (n+1)! + 1 is not prime.  Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 03 2004
The prime members are in A093804 (numbers n such that Sum_{dn} d! is prime) since Sum_{dn} d! = n! + 1 if n is prime.  Jonathan Sondow
150209 is also in the sequence, cf. the link to Caldwell's prime pages.  M. F. Hasler, Nov 04 2011


REFERENCES

J.M. De Koninck, Ces nombres qui nous fascinent, Entry 116, p. 40, Ellipses, Paris 2008.
Harvey Dubner, Factorial and primorial primes, J. Rec. Math., 19 (No. 3, 1987), 197203.
Richard K. Guy, Unsolved Problems in Number Theory, Section A2.
F. Le Lionnais, Les Nombres Remarquables, Paris, Hermann, 1983, p. 100.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).


LINKS



EXAMPLE

3! + 1 = 7 is prime, so 3 is in the sequence.


MATHEMATICA

v = {0, 1, 2}; Do[If[ !PrimeQ[n + 1] && PrimeQ[n! + 1], v = Append[v, n]; Print[v]], {n, 3, 29651}]


PROG

(Magma) [n: n in [0..800]  IsPrime(Factorial(n)+1)]; // Vincenzo Librandi, Oct 31 2018
(Python)
from sympy import factorial, isprime
for n in range(0, 800):
if isprime(factorial(n)+1):


CROSSREFS



KEYWORD

nonn,nice,hard,more


AUTHOR



EXTENSIONS

a(20) from Ken Davis (kraden(AT)ozemail.com.au), May 24 2002
a(21) found by PrimeGrid around Jun 11 2011, submitted by Eric W. Weisstein, Jun 13 2011


STATUS

approved



