OFFSET
1,2
PROG
(Python)
from itertools import count, islice
from math import gcd
from sympy import isprime
def A376584_gen(): # generator of terms
aset, a, b = {1, 2}, 2, 3
yield from (1, 2)
for i in count(3):
c = b
if isprime(a):
while c in aset or gcd(c, a)>1:
c+=1
else:
while c in aset or gcd(c, a)==1:
c+=1
aset.add(a:=c)
if i == c:
yield i
while b in aset:
b += 1
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Sep 29 2024
EXTENSIONS
a(40)-a(42) from Scott R. Shannon, Oct 02 2024
STATUS
approved