A359940 Lexicographically earliest sequence of distinct primes whose partial products lie between noncomposite numbers.
2, 3, 5, 19, 11, 7, 31, 23, 193, 67, 367, 131, 317, 1097, 241, 1777, 773, 2819, 2689, 1381, 1741, 3389, 631, 8581, 41, 1553, 2297, 1427, 17053, 1493, 883, 619, 9803, 13331, 26203, 37, 7681, 41269, 1913, 27091, 3079, 31583, 5867, 22409, 13367, 37337, 29573, 6469
Offset: 1
Keywords
Examples
2 - 1 = 1 and 2 + 1 = 3 are both noncomposite numbers. 2*3 - 1 = 5 and 2*3 + 1 = 7 are both noncomposite numbers. 2*3*5 - 1 = 29 and 2*3*5 + 1 = 31 are both noncomposite numbers.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..230
Programs
-
Maple
P:= {seq(ithprime(i),i=2..10^5)}: R:= 2: s:= 2: for i from 2 to 100 do found:= false; for p in P do if isprime(p*s-1) and isprime(p*s+1) then R:= R,p; s:= p*s; P:= P minus {p}; found:= true; break fi; od; if not found then break fi od: R; # Robert Israel, Jan 19 2023
-
Mathematica
a[1] = 2; a[n_] := a[n] = Module[{t = Table[a[k], {k, 1, n - 1}], p = 2, r}, r = Times @@ t; While[MemberQ[t, p] || ! PrimeQ[r*p - 1] || ! PrimeQ[r*p + 1], p = NextPrime[p]]; p]; Array[a, 50]