login
A376199
Index where n appears in A376198.
3
1, 2, 3, 4, 9, 5, 10, 6, 7, 8, 11, 12, 23, 13, 14, 15, 24, 16, 25, 17, 18, 19, 26, 20, 21, 22, 27, 28, 52, 29, 53, 30, 31, 32, 33, 34, 54, 35, 36, 37, 55, 38, 56, 39, 40, 41, 57, 42, 43, 44, 45, 46, 58, 47, 48, 49, 50, 51, 59, 60, 110, 61, 62, 63, 64, 65, 111, 66, 67, 68, 112, 69, 113, 70, 71, 72, 73, 74, 114, 75, 76, 77, 115, 78, 79
OFFSET
1,2
LINKS
PROG
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def agen(): # generator of terms
an, smc, smp, adict, n = 2, 4, 3, {1: 1, 2: 2}, 1
for k in count(3):
if not isprime(an):
an = smp if an == 2*smp else smc
else:
an = smp if smp < smc else smc
if an == smp: smp = nextprime(smp)
else:
smc += 1
while isprime(smc): smc += 1
if an not in adict: adict[an] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 85))) # Michael S. Branicky, Oct 03 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 03 2024
STATUS
approved