login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A376750
Indices n where a run of primes begins in A376198.
10
2, 9, 23, 52, 110, 231, 472, 965, 1958, 3962, 7980, 16029, 32181, 64597, 129574, 259798, 520835, 1043833, 2091473, 4190135, 8392863, 16809322, 33661860, 67402676, 134952624, 270177158, 540861852, 1082667610, 2167106199, 4337519113, 8681255531, 17374202846, 34770433922, 69582458821, 139243546013, 278635987083
OFFSET
1,1
PROG
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def A376750_4gen(): # generator of terms for A376750..4
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