This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A036012 #34 Jan 20 2024 12:34:41 %S A036012 2,2,3,3,2,6,3,2,4,7,7,3,8,6,2,3,6,9,6,14,19,11,4,4,19,4,13,3,10,13, %T A036012 15,4,11,9,2,5,26,19,52,21,20,63,4,19,17,6,29,19,3,5,51,11,14,15,7,12, %U A036012 44,34,7,21,32,3,22,10,19,19,7,20,4,22,4,17,35,47,40,14,5,14,36,39,16 %N A036012 a(n) = smallest number > 1 such that a(1)a(2)...a(n) + 1 is prime. %C A036012 Except for the first term, same as A084401. - _David Wasserman_, Dec 22 2004 %H A036012 Michael S. Branicky, <a href="/A036012/b036012.txt">Table of n, a(n) for n = 1..1000</a> (terms 1..300 from T. D. Noe) %F A036012 Conjecture: a(n) = O(n). - _Thomas Ordowski_, Aug 08 2017 %p A036012 n := 1: while true do j := 2: while not isprime(j*n+1) do j := j+1: od: print(j): n := n*j: od: %t A036012 a[1] = 2; a[n_] := a[n] = Catch[For[an = 2, True, an++, If[PrimeQ[Product[a[k], {k, 1, n - 1}]*an + 1], Throw[an]]]]; Table[a[n], {n, 1, 81}] (* _Jean-François Alcover_, Nov 27 2012 *) %t A036012 nxt[{t_,n_}]:=Module[{k=2},While[!PrimeQ[t*k+1],k++];{t*k,k}]; NestList[ nxt,{2,2},80][[All,2]] (* _Harvey P. Dale_, Oct 03 2020 *) %o A036012 (Python) %o A036012 from gmpy2 import is_prime %o A036012 from itertools import count, islice %o A036012 def agen(): # generator of terms %o A036012 p = 1 %o A036012 while True: %o A036012 an = next(k for k in count(2) if (t:=p*k+1) == 1 or is_prime(t)) %o A036012 p *= an %o A036012 yield an %o A036012 print(list(islice(agen(), 81))) # _Michael S. Branicky_, Jan 20 2024 %Y A036012 Equals A084716(n+1)/A084716(n). %Y A036012 Cf. A036013, A084716, A084717, A084718. %K A036012 nonn,nice,easy %O A036012 1,1 %A A036012 _Russell Easterly_ %E A036012 More terms from _Erich Friedman_ %E A036012 More terms from _Jud McCranie_, Jan 26 2000 %E A036012 Description corrected by _Len Smiley_