%I #21 Jun 04 2022 13:04:52
%S 1,2,5,3,7,12,19,4,13,21,8,25,6,17,11,23,9,29,39,10,31,15,37,14,41,16,
%T 47,65,18,53,20,57,83,22,61,27,55,79,24,67,26,71,33,73,43,75,119,30,
%U 89,32,81,28,93,35,86,149,34,101,45,91,127,36,107,38,111,49,97,139,40,117,167,42,121,46
%N a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that is coprime to a(n-1) and the difference | a(n) - a(n-1) | is distinct from all previous differences.
%C All of the terms are concentrated along four lines - this is in contrast to A352588 where they all concentrated along one line. See the linked image. The primes do not occur in their natural order. The sequence is conjectured to be a permutation of the positive integers.
%C See A354731 for the differences between terms.
%H Michael De Vlieger, <a href="/A354688/b354688.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael De Vlieger, <a href="/A354688/a354688_1.png">Annotated log log scatterplot of a(n)</a>, n = 1..2^14, showing records in red and local minima in blue, highlighting primes in green and fixed points in gold.
%H Scott R. Shannon, <a href="/A354688/a354688.png">Image of the first 10000 terms</a>. The green line is y = n.
%e a(6) = 12 as a(5) = 7, and 12 is the smallest unused number that is coprime to 7 and whose difference from the previous term, | 12 - 7 | = 5, has not appeared. Note that 4,6,8,9,10,11 are all coprime to 7 but their differences from 7 have all appeared as differences between previous terms so none can be chosen.
%t nn = 120; c[_] = d[_] = 0; a[1] = c[1] = 1; a[2] = c[2] = j = 2; u = 3; 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}]; j = k; If[k == u, While[c[u] > 0, u++]], {i, 3, nn}]; Array[a, nn] (* _Michael De Vlieger_, Jun 04 2022 *)
%o (Python)
%o from math import gcd
%o from sympy import isprime, nextprime
%o from itertools import count, islice
%o def agen(): # generator of terms
%o aset, diffset, an, mink = {1}, set(), 1, 2
%o yield 1
%o for n in count(2):
%o k = mink
%o while k in aset or abs(an-k) in diffset or gcd(an, k) != 1: k += 1
%o aset.add(k); diffset.add(abs(k-an)); an = k; yield an
%o while mink in aset: mink += 1
%o print(list(islice(agen(), 74))) # _Michael S. Branicky_, Jun 04 2022
%Y Cf. A354731, A352588, A093714, A354687, A354721.
%K nonn
%O 1,2
%A _Scott R. Shannon_, Jun 03 2022