OFFSET
1,7
COMMENTS
a(n) = 0 iff n+1 is prime.
Since rather large numbers (up to 238 digits) are encountered in the computation, the Pocklington-Lehmer "P-1" primality test is used, as implemented in PARI 2.1.3.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..522
EXAMPLE
7+1 = 8, 7*8+1 = 57, 7*8*9+1 = 505, 7*8*9*10+1 = 5041 are all composite, but 7*8*9*10*11 + 1 = 55441 is prime, so a(7) = 4,
MATHEMATICA
Array[If[PrimeQ@ #, 0, Block[{k = 1}, While[! PrimeQ[Pochhammer[# - 1, k + 1] + 1], k++]; k]] &, 99, 2] (* Michael De Vlieger, Dec 16 2017 *)
PROG
(PARI) for(n=1, 100, k=0; m=n; while(!isprime(m+1, 1), k++; m=m*(n+k)); print1(k, ", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Sep 15 2003
EXTENSIONS
Edited and extended by Klaus Brockhaus, Sep 17 2003
Escape-clause added to the definition by Antti Karttunen, Dec 16 2017
STATUS
approved