cp's OEIS Frontend

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.

A359948 Lexicographically earliest sequence of primes whose partial products lie between noncomposite numbers.

This page as a plain text file.
%I A359948 #20 Jul 08 2023 10:42:28
%S A359948 2,2,3,5,3,13,5,7,41,13,83,109,347,337,127,67,379,499,739,4243,2311,
%T A359948 1973,5827,7333,971,3449,3967,3407,12671,1423,859,20641,7237,769,9209,
%U A359948 281,12919,16633,11383,30449,6733,40627,34591,1103,14303,5479,4603,17477,5113,51001,36299,57037,1153,34297,1237
%N A359948 Lexicographically earliest sequence of primes whose partial products lie between noncomposite numbers.
%C A359948 Are there any repeated terms other than a(1) = a(2) = 2, a(3) = a(5) = 3, a(4) = a(7) = 5 and a(6) = a(10) = 13?
%H A359948 Michael S. Branicky, <a href="/A359948/b359948.txt">Table of n, a(n) for n = 1..160</a>
%e A359948 2 - 1 = 1 and 2 + 1 = 3 are both noncomposites.
%e A359948 2*2 - 1 = 3 and 2*2 + 1 = 5 are both primes.
%e A359948 2*2*3 - 1 = 11 and 2*2*3 + 1 = 13 are both primes.
%e A359948 2*2*3*5 - 1 = 59 and 2*2*3*5 + 1 = 61 are both primes.
%p A359948 R:= 2: s:= 2:
%p A359948 for i from 2 to 60 do
%p A359948   p:= 1:
%p A359948   do
%p A359948     p:= nextprime(p);
%p A359948   if isprime(p*s-1) and isprime(p*s+1) then R:= R,p; s:= p*s; break fi;
%p A359948 od od:
%p A359948 R;
%t A359948 a[1] = 2; a[n_] := a[n] = Module[{r = Product[a[k], {k, 1, n - 1}], p = 2}, While[! PrimeQ[r*p - 1] || ! PrimeQ[r*p + 1], p = NextPrime[p]]; p]; Array[a, 55] (* _Amiram Eldar_, Jan 19 2023 *)
%o A359948 (Python)
%o A359948 from itertools import islice
%o A359948 from sympy import isprime, nextprime
%o A359948 def agen(): # generator of terms
%o A359948     s = 2; yield 2
%o A359948     while True:
%o A359948         p = 2
%o A359948         while True:
%o A359948             if isprime(s*p-1) and isprime(s*p+1):
%o A359948                 yield p; s *= p; break
%o A359948             p = nextprime(p)
%o A359948 print(list(islice(agen(), 55))) # _Michael S. Branicky_, Jan 19 2023
%Y A359948 Cf. A036014, A359940.
%K A359948 nonn
%O A359948 1,1
%A A359948 _Robert Israel_, Jan 19 2023