OFFSET
1,2
COMMENTS
See A354687 for further details.
LINKS
Michael De Vlieger, Annotated log log scatterplot of a(n), n = 1..2^14, showing records in red and local minima in blue, highlighting primes in green and fixed points in gold.
Scott R. Shannon, Image of the first 100000 terms. The green line is y = n.
MATHEMATICA
nn = 120; c[_] = d[_] = 0; a[1] = c[1] = 1; a[2] = c[2] = j = 2; u = 3; {1}~Join~Reap[Do[Set[k, u]; While[Nand[c[k] == 0, d[Abs[k - j]] == 0, ! CoprimeQ[j, k]], k++]; Set[{a[i], c[k], d[Abs[k - j]]}, {k, i, i}]; Sow[Abs[k - j]]; j = k; If[k == u, While[c[u] > 0, u++]], {i, 3, nn}]][[-1, -1]] (* Michael De Vlieger, Jun 04 2022 *)
PROG
(Python)
from math import gcd
from sympy import isprime, nextprime
from itertools import count, islice
def agen(): # generator of terms
aset, diffset, an, mink = {1, 2}, {1}, 2, 3
yield from [1]
for n in count(3):
k = mink
while k in aset or abs(an-k) in diffset or gcd(an, k) == 1: k += 1
aset.add(k); diffset.add(abs(k-an)); yield abs(an-k); an = k
while mink in aset: mink += 1
print(list(islice(agen(), 76))) # Michael S. Branicky, Jun 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Jun 04 2022
STATUS
approved