OFFSET
1,1
PROG
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
an, smc, smp = 2, 4, 3,
wasprime = startp = startn = endp = endn = rl = 0
for n in count(2):
if not isprime(an):
if wasprime: # a run has ended
endn, endp = n-1, wasprime
yield startn, startp, endn, endp, rl
an = smp if an == 2*smp else smc
wasprime = 0 # False
else:
if not wasprime: # a run has started
startn, startp, rl = n, an, 1
else: rl += 1
wasprime = an
an = smp if smp < smc else smc
if an == smp: smp = nextprime(smp)
else:
smc += 1
while isprime(smc): smc += 1
print([out[0] for out in list(islice(A376750_4gen(), 15))]) # Michael S. Branicky, Oct 03 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 03 2024
EXTENSIONS
a(14)-a(33) from Michael S. Branicky, Oct 04 2024
a(34)-a(36) from Michael S. Branicky, Oct 07 2024
STATUS
approved