OFFSET
1,2
MATHEMATICA
nn = 2^20; c = {1}; j = 1; s = 0; u = 1; {1}~Join~Reap[Do[k = u; While[Nand[FreeQ[c, k], CoprimeQ[j, k], k != j + 1], k++]; j = k; AppendTo[c, k]; If[k == u, If[OddQ[u], Sow[u]]; While[MemberQ[c, u], u++]; c = DeleteCases[c, _?(# < u &)]], {i, 2, nn}]][[-1, -1]]
PROG
(Python)
from math import gcd
from itertools import islice
def agen(): # generator of terms
an, aset, mink, seen = 1, {1}, 2, {1}
yield 1
while True:
if mink%2 and mink not in seen: yield mink; seen.add(mink)
k = mink
while k in aset or gcd(an, k) != 1 or k-an == 1: k += 1
an = k; aset.add(an)
while mink in aset: mink += 1
print(list(islice(agen(), 42))) # Michael S. Branicky, May 03 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael De Vlieger, May 03 2022
STATUS
approved