OFFSET
1,2
LINKS
Iain Fox, Table of n, a(n) for n = 1..500
MATHEMATICA
For[n = 2; res = {1}; z = 1, n <= 1000, n++, If[PrimeQ[n z + 1] || PrimeQ[n z - 1], AppendTo[res, n]; z *= n]] res (* J. Mulder (jasper.mulder(AT)planet.nl), Jan 28 2010 *)
nxt[{prd_, a_}]:=Module[{c=a+1}, While[ NoneTrue[prd*c+{1, -1}, PrimeQ], c++]; {prd*c, c}]; NestList[nxt, {1, 1}, 60][[All, 2]] (* Harvey P. Dale, Jan 12 2022 *)
PROG
(PARI) first(n) = { my(res = vector(n), p=1); res[1]=1; for(x=2, n, my(k=res[x-1]+1); while(!ispseudoprime(p*k+1) && !ispseudoprime(p*k-1), k++); res[x]=k; p*=k); res; } \\ Iain Fox, Nov 30 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
G. L. Honaker, Jr., Jan 22 2010
EXTENSIONS
Terms beyond a(15) from R. J. Mathar and J. Mulder (jasper.mulder(AT)planet.nl), Jan 25 2010
STATUS
approved