OFFSET
1,1
COMMENTS
k! + p is composite for k >= p since p divides k! for k >= p.
The first 10^6 terms are nonzero. Remarkably, the number 7426189 + m! is composite for all m <= 1793. - T. D. Noe, Mar 02 2010
Apparently it is not known whether a(n) is ever zero. - N. J. A. Sloane, Aug 11 2011
LINKS
Robert Israel, Table of n, a(n) for n = 1..227
EXAMPLE
For n = 4, 3!+7 = 13, 4!+7=31, 5!+7=127 and 6!+7 = 727 are the 4 primes in n!+7.
MAPLE
MATHEMATICA
Table[Count[Range[0, Prime[n]-1]!+Prime[n], _?PrimeQ], {n, 70}] (* Harvey P. Dale, Feb 06 2019 *)
PROG
(Python)
from sympy import isprime, prime
from itertools import count, islice
def agen(): # generator of terms
for n in count(1):
pn, fk, an = prime(n), 1, 0
for k in range(1, pn+1):
if isprime(pn + fk): an += 1
fk *= k
yield an
print(list(islice(agen(), 40))) # Michael S. Branicky, Apr 16 2022
(PARI) nfactppct(n) = { forprime(p=1, n, c=0; for(x=0, n, y=x!+p; if(isprime(y), c++) ); print1(c", ") ) } \\ Cino Hilliard, Apr 15 2004
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeff Burch, Apr 27 2003
EXTENSIONS
Edited by Franklin T. Adams-Watters, Aug 01 2006
Offset corrected by Robert Israel, May 26 2021
STATUS
approved