OFFSET
0,5
COMMENTS
Conjecture: No term is a composite number. a(n) is a prime > 3*prime(k), where k is such that prime(k) < n <= prime(k+1). - Amarnath Murthy, Apr 07 2004
Terms after n = 2000 in the b-file correspond to Fermat and Lucas PRP. - Phillip Poplin, Oct 12 2019
LINKS
Phillip Poplin, Table of n, a(n) for n = 0..4000 (first 501 terms from T. D. Noe, then up to n=2000 from Hans Havermann)
Antonín Čejchan, Michal Křížek, and Lawrence Somer, On Remarkable Properties of Primes Near Factorials and Primorials, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4.
FORMULA
a(n) = A151800(n!) - n!. - Max Alekseyev, Jul 23 2014
MAPLE
a:= n-> (f-> nextprime(f)-f)(n!):
seq(a(n), n=0..70); # Alois P. Heinz, Feb 22 2023
MATHEMATICA
a[n_] := (an = 1; While[ !PrimeQ[n! + an], an++]; an); Table[a[n], {n, 0, 63}] (* Jean-François Alcover, Dec 05 2012 *)
NextPrime[#]-#&/@(Range[0, 70]!) (* Harvey P. Dale, May 18 2014 *)
PROG
(PARI) for(n=0, 70, k=1; while(!isprime(n!+k), k++); print1(k, ", "))
(PARI) a(n) = nextprime(n!+1) - n!; \\ Michel Marcus, Dec 25 2020
(Python)
from sympy import factorial, nextprime
def a(n): fn = factorial(n); return nextprime(fn) - fn
print([a(n) for n in range(64)]) # Michael S. Branicky, May 22 2022
CROSSREFS
KEYWORD
nice,nonn
AUTHOR
EXTENSIONS
More terms from Jud McCranie
a(21) onwards from Wouter Meeussen
Better description from Rick L. Shepherd, Nov 06 2002
STATUS
approved