OFFSET
1,2
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..5715
Rémy Sigrist, C program
PROG
(Python)
from math import lcm, gcd
from itertools import count, islice
from collections import deque
from sympy import factorint
def A354791_gen(): # generator of terms
aset, aqueue, c, b, f, i = {1}, deque([1]), 2, 1, True, 1
yield 1
while True:
for m in count(c):
if m not in aset and gcd(m, b) == 1 and all(map(lambda n:n<=1, fs:=factorint(m).values())):
i += 1
if len(fs) > 1:
yield i
aset.add(m)
aqueue.append(m)
if f: aqueue.popleft()
b = lcm(*aqueue)
f = not f
while c in aset:
c += 1
break
(C) See Links section.
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael De Vlieger and N. J. A. Sloane, Jul 17 2022
EXTENSIONS
More terms from Rémy Sigrist, Jul 17 2022
STATUS
approved