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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #11 Jan 12 2022 18:09:39

%S 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,

%T 53,55,67,72,85,97,98,123,130,131,132,138,141,146,180,182,185,188,192,

%U 201,225,231,236,240,248,252,254,276,300,322,326,346,372,401,413,424

%N 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.

%H Iain Fox, <a href="/A172024/b172024.txt">Table of n, a(n) for n = 1..500</a>

%H <a href="http://www.primecurios.com">Prime Curios!</a>

%t 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 *)

%t 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 *)

%o (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

%K nonn

%O 1,2

%A _G. L. Honaker, Jr._, Jan 22 2010

%E Terms beyond a(15) from _R. J. Mathar_ and J. Mulder (jasper.mulder(AT)planet.nl), Jan 25 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 March 28 20:05 EDT 2024. Contains 371254 sequences. (Running on oeis4.)