A354151 Lengths of successive runs of primes in A090252.
3, 1, 3, 2, 7, 5, 1, 14, 11, 2, 1, 29, 22, 5, 2, 58, 1, 45, 1, 1, 10, 1, 5, 117, 3, 90, 2, 2, 21, 2, 11, 1, 1, 39, 195, 7, 181, 5, 5, 1, 42, 7, 23, 2, 3, 79, 391, 14, 1, 362, 1, 11, 1, 1, 11, 1, 1, 3, 1, 85, 15, 46, 5, 7, 158, 782, 1, 29, 1, 3, 1, 725, 1, 1, 2, 22, 2, 2, 23, 2, 3, 7, 2, 170, 31, 93, 1, 1, 11, 15, 317, 1, 1089, 475, 2, 58, 1, 1, 3, 7, 2, 1450
Offset: 1
Keywords
Examples
A090252 begins 1, 2, 3, 5, 4, 7, 9, 11, 13, 17, 8, 19, 23, 25, 21, 29, 31, ... which, writing N for a nonprime and P for a prime, is NPPPNPNPPPNPPNPP... The runs of primes have lengths 3, 1, 3, 2, ...
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..2148 [Based on Russ Cox's 5 million term data file for A090252]
Programs
-
Python
from math import gcd, prod from sympy import isprime from itertools import count, islice def agen(): # generator of terms alst, aset, mink, run = [1], {1}, 2, 0 for n in count(2): k, s = mink, n - n//2 prodall = prod(alst[n-n//2-1:n-1]) while k in aset or gcd(prodall, k) != 1: k += 1 alst.append(k); aset.add(k) if isprime(k): run += 1 elif run > 0: yield run; run = 0 while mink in aset: mink += 1 print(list(islice(agen(), 45))) # Michael S. Branicky, May 28 2022