OFFSET
1,1
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..6
EXAMPLE
a(3) = 167 = (Product_{k=1..3} A001359(k)) + 2 = 3 * 5 * 11 + 2 = A097489(3) + 2. - Hartmut F. W. Hoft, Apr 27 2021
MATHEMATICA
step[{list_, q_}] := Module[{p=NextPrime[q]}, {Join[list, If[PrimeQ[p+2], {{p, p+2}}, {}]], p}]
smallerTwin[n_] := First[Transpose[First[NestWhile[step, {{{3, 5}}, 3}, Length[First[step[#]]]<=n&]]]]
a097489[n_] := Rest[FoldList[Times, 1, smallerTwin[n]]]
a097490[n_] := Select[Map[#+2&, a097489[n]], PrimeQ]
a097490[39] (* Hartmut F. W. Hoft, Apr 27 2021 *)
PROG
(PARI) fp(n) = p=1; for(x=1, n, p*=twinl(x); if(isprime(p+2), print1(p+2", ")))
twinl(n) = { local(c, x); c=0; x=1; while(c<n, if(isprime(prime(x)+2), c++); x++; ); return(prime(x-1)) }
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Aug 24 2004
EXTENSIONS
Edited by Don Reble, Apr 16 2007
STATUS
approved