login
a(n) = smallest number > 1 such that a(1)a(2)...a(n) - 1 is prime (or 1).
6

%I #26 Jan 20 2024 09:16:55

%S 2,2,2,3,2,4,2,3,6,4,5,5,5,10,4,3,5,8,22,13,14,2,5,5,2,20,9,9,24,5,26,

%T 15,14,25,25,4,9,30,9,21,12,11,10,2,40,19,8,13,11,50,3,25,25,8,5,25,

%U 46,19,47,54,9,13,14,43,4,24,28,16,33,25,152,2,11,22,6,78,87,7,10,21

%N a(n) = smallest number > 1 such that a(1)a(2)...a(n) - 1 is prime (or 1).

%H Michael S. Branicky, <a href="/A036013/b036013.txt">Table of n, a(n) for n = 1..1600</a> (terms 1..300 from T. D. Noe)

%t sng1[{t_,a_}]:=Module[{k=2},While[CompositeQ[t k-1],k++];{t*k,k}]; NestList[sng1,{2,2},80][[;;,2]] (* _Harvey P. Dale_, May 20 2023 *)

%o (Python)

%o from sympy import isprime

%o from itertools import count

%o a,p = [2],2

%o for _ in range(100):

%o q = next(filter(lambda x:isprime(x*p-1), count(2)))

%o p = p*q

%o a.append(q)

%o print(a) # _Nicholas Stefan Georgescu_, Mar 06 2023

%Y Cf. A036012, A058000 (corresponding primes).

%K nonn,nice,easy

%O 1,1

%A _Russell Easterly_

%E More terms from _Erich Friedman_. More terms from _Jud McCranie_, Jan 26 2000.