OFFSET
0,8
COMMENTS
The (n-1) consecutive numbers n!+2, ..., n!+n (for n >= 2) are not prime. This fact implies that there are arbitrarily large gaps in the distribution of the prime numbers. However, n!+n+1 need not be a prime number. Now a(n) measures, when the next prime number after n!+n appears. Thus a(n)=0 means that n!+n+1 is prime and so on. Obviously, a(n) is parity conserving for n >= 2. I.e., if n >= 2 then 2 divides n iff 2 divides a(n).
Conjectures: By definition a(n)+n!+1 is prime, but is a(n)+n+1=A037153(n) also a prime number for all n > 2? Is the growth of b(n) := Sum_{k=0..n} a(k) quadratic, that is, is b(n)=O(n^2)?
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..500
EXAMPLE
a(5)=1 because 5!+5+1+1=127 is prime and 126 is not.
a(7)=3 because 7!+7+3+1=5051 is prime and 5048, 5049 and 5050 are not prime.
MAPLE
a := proc(n) option remember; local r, m, k: r := n!+n: k := 1: m := r+1: while (not isprime(m)) do k := k+1: while (not igcd(k, n)=1) do k := k+1: od: m := r+k: od: k-1; end;
# alternatively:
a := proc(n) option remember; nextprime(n!+n)-n!-n-1; end;
MATHEMATICA
lnik[n_]:=Module[{c=n!+n+1}, If[PrimeQ[c], 0, NextPrime[c]-c]]; Array[ lnik, 80, 0] (* Harvey P. Dale, Apr 08 2019 *)
PROG
(PARI) a(n) = apply(x->(nextprime(x)-x), n!+n+1); \\ Michel Marcus, Mar 21 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Frederick Magata (frederick.magata(AT)uni-muenster.de), Feb 09 2004
STATUS
approved