login
a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that shares a factor with a(n-1) and the difference | a(n) - a(n-1) | is distinct from all previous differences.
11

%I #23 Jun 04 2022 13:04:11

%S 1,2,4,8,14,6,3,12,22,10,5,20,34,16,32,52,13,26,48,15,36,9,33,44,18,

%T 46,23,69,21,28,58,24,56,7,42,78,27,72,30,55,11,66,104,38,19,76,116,

%U 29,87,141,39,91,35,85,17,102,40,100,25,90,153,45,114,50,120,192,51,68,142,54,130,208,60

%N a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that shares a factor with a(n-1) and the difference | a(n) - a(n-1) | is distinct from all previous differences.

%C The terms are concentrated along many different lines, although three lines contain a higher concentration of terms than the others; these are similar to the three lines seen in A064413. See the linked image. The primes do not occur in their natural order, and unlike A064413, the terms proceeding and following a prime term can be high multiples of the prime.

%C In the first 200000 terms the fixed points are 1,2,6,10,68. It is plausible no more exist although this is unknown. The sequence is conjectured to be a permutation of the positive integers.

%C See A354721 for the differences between terms.

%H Michael De Vlieger, <a href="/A354687/b354687.txt">Table of n, a(n) for n = 1..10000</a>

%H Michael De Vlieger, <a href="/A354687/a354687_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="/A354687/a354687.png">Image of the first 100000 terms</a>. The green line is y = n.

%e a(4) = 8 as a(3) = 4, and 8 is the smallest unused number that shares a factor with 4 and whose difference from the previous term,| 8 - 4 | = 4, has not appeared. Note 6 shares a factor with 4 but | 6 - 4 | = 2, and a difference of 2 has already occurred between as | a(3) - a(2) |, so 6 cannot 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, 2}, {1}, 2, 3

%o yield from [1, 2]

%o for n in count(3):

%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(), 73))) # _Michael S. Branicky_, Jun 04 2022

%Y Cf. A354721, A064413, A354688, A354731, A354087, A352763.

%K nonn

%O 1,2

%A _Scott R. Shannon_, Jun 03 2022