|
MATHEMATICA
|
step[{list_, q_}] := Module[{p=NextPrime[q]}, {Join[list, If[PrimeQ[p+2], {{p, p+2}}, {}]], p}]
largerTwin[n_] := Last[Transpose[First[NestWhile[step, {{{3, 5}}, 3}, Length[First[step[#]]]<=n&]]]]
a097492[n_] := Rest[FoldList[Times, 1, largerTwin[n]]]
a097493[n_] := Select[Map[#+2&, a097492[n]], PrimeQ]
|
|
PROG
|
(PARI) fu(n) = p=1; for(x=1, n, p*=twinu(x); if(isprime(p+2), print1(p+2", "))) \The n-th upper twin prime twinu(n) = { local(c, x); c=0; x=1; while(c<n, if(isprime(prime(x)+2), c++); x++; ); return(prime(x)) }
|