login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


A172024
a(n) = smallest number > a(n-1) such that a(1)*a(2)*...*a(n) + 1 or a(1)*a(2)*...*a(n) - 1 is prime.
1
1, 2, 3, 4, 7, 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 23, 26, 27, 30, 35, 36, 37, 39, 40, 43, 53, 55, 67, 72, 85, 97, 98, 123, 130, 131, 132, 138, 141, 146, 180, 182, 185, 188, 192, 201, 225, 231, 236, 240, 248, 252, 254, 276, 300, 322, 326, 346, 372, 401, 413, 424
OFFSET
1,2
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
Sequence in context: A256606 A101128 A182802 * A285500 A119345 A086391
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 19 20:04 EDT 2024. Contains 376014 sequences. (Running on oeis4.)