OFFSET
1,3
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
Antti Karttunen, Data supplement: n, a(n) computed for n = 1..100000
FORMULA
a(n) <= A175682(n). - Antti Karttunen, Jan 03 2019
EXAMPLE
a(107)=8 because 107=prime, 107+2=109=prime, 107+2*3=113=prime, 107+2*3*5=137=prime, 107+2*3*5*7=317=prime, 107+2*3*5*7*11=2417=prime, 107+2*3*5*7*11*13=30137=prime, 107+2*3*5*7*11*13*17=510617=prime.
MAPLE
A002110 := proc(n) option remember; mul(ithprime(i), i=1..n) ; end proc:
A175663 := proc(n) if isprime(n) then for p from 1 do if not isprime(n+A002110(p)) then return p ; end if; end do: else return 0 ; end if; end proc:
seq(A175663(n), n=1..120) ; # R. J. Mathar, Aug 07 2010
MATHEMATICA
Array[If[PrimeQ@ #, Block[{s = {1}}, While[PrimeQ[# + Times @@ Prime@ s], AppendTo[s, s[[-1]] + 1]]; Last@ s], 0] &, 105] (* Michael De Vlieger, Jan 03 2019 *)
PROG
(PARI) A175663(n) = if(!isprime(n), 0, my(pr=2); for(k=1, oo, if(!isprime(pr+n), return(k)); pr *= prime(1+k))); \\ Antti Karttunen, Jan 03 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladislav-Stepan Malakovsky & Juri-Stepan Gerasimov, Aug 04 2010
STATUS
approved