Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #29 Jan 13 2023 08:41:23
%S 1,2,3,5,7,8,9,11,12,14,17,20,24,30,34,44,72,85,86,92,115,122,125,132,
%T 142,150,161,162,181,186,198,224,248,252,282,283,290,307,319,321,344,
%U 350,376,445,476,567,623,676,682,704,741,749,786,803,806,893,1014,1046
%N a(n) = smallest positive integer > a(n-1) such that 2*a(1)*a(2)*...*a(n) + 1 is prime.
%H Jon E. Schoenfield, <a href="/A144717/b144717.txt">Table of n, a(n) for n = 1..505</a> (lists all terms < 10^5)
%e a(1)=1 because a(0) is not defined and 2*1 + 1 = 3 is prime;
%e a(2)=2 because 2*1*2 + 1 = 5 is prime;
%e a(3)=3 because 2*1*2*3 + 1 = 13 is prime;
%e a(4) is not 4 because 2*1*2*3*4 + 1 = 49 is not prime, but a(4)=5 works because 2*1*2*3*5 + 1 = 61 is prime.
%t k = 2; a = {}; Do[If[PrimeQ[k n + 1], k = k n; AppendTo[a, n]], {n, 1, 3000}]; a (* _Artur Jasinski_ *)
%t nxt[{p_,a_}]:=Module[{k=a+1},While[!PrimeQ[p*k+1],k++];{p*k,k}]; NestList[ nxt,{2,1},60][[All,2]] (* _Harvey P. Dale_, Aug 18 2021 *)
%o (Python)
%o from sympy import isprime
%o from itertools import count, islice
%o def agen(): # generator of terms
%o an, p = 1, 2
%o while True:
%o yield an
%o an = next(k for k in count(an+1) if isprime(p*k+1))
%o p *= an
%o print(list(islice(agen(), 58))) # _Michael S. Branicky_, Jan 13 2023
%Y Cf. A046966, A046972, A144718, A144722, A144723, A144724, A144725, A144726, A144727, A144728, A144729, A144730, A144731.
%K nonn,nice
%O 1,2
%A _Artur Jasinski_, Sep 19 2008
%E Edited by _N. J. A. Sloane_, Sep 21 2017 following suggestions from Richard C. Schroeppel