OFFSET
1,2
PROG
(Python)
from math import gcd
from itertools import count, islice
from sympy import primefactors
def A352191_gen(): # generator of terms
bset, blist, mmax, c = {1, 2}, [1, 2], 3, 2
yield from blist
while True:
for m in count(mmax):
if gcd(m, blist[-1]) > 1 and m not in bset:
if all(blist[-2] % p == 0 for p in primefactors(blist[-1])) or gcd(m, blist[-2]) == 1:
if m > c:
yield m
c = m
blist = [blist[-1], m]
bset.add(m)
while mmax in bset:
mmax += 1
break
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 13 2022
STATUS
approved