This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A373860 #19 Jun 20 2024 11:12:03 %S A373860 1,2,3,4,6,8,9,12,10,14,5,15,20,7,18,16,21,28,22,24,11,27,33,30,26,25, %T A373860 36,13,35,39,40,32,34,38,17,42,19,51,57,45,48,44,46,50,23,54,52,56,58, %U A373860 49,69,63,60,29,66,55,87,65,72,62,64,31,70,68,74,76,37,93,111,75,78,80,81,84,82,77,90 %N A373860 a(n) = n for n <= 4; for n > 4, a(n) is the smallest unused positive number that shares a factor with the most recently appearing even number prior to a(n-1) if a(n-1) is even, otherwise it shares a factor with the most recently appearing odd number prior to a(n-1) if a(n-1) is odd. %C A373860 The terms appear to follow a pattern similar to the EKG sequence A064413, i.e., the terms are concentrated along just three lines of different gradients, and the lower line consists only of primes. The uppermost line appears to be composed only of semiprimes that are divisible by 3, while the middle line contains all other terms. See the attached images. For the first 100000 terms the primes appear in their natural order, implying that is likely true for all n. %C A373860 The fixed points are 1, 2, 3, 4, 16, 32, 124, and it is likely that no more exist. The sequence is conjectured to be a permutation of the positive numbers. %H A373860 Scott R. Shannon, <a href="/A373860/b373860.txt">Table of n, a(n) for n = 1..10000</a> %H A373860 Scott R. Shannon, <a href="/A373860/a373860.png">Image of the first 5000 terms</a>. Numbers with one, two, three, four, or five and more prime factors, counted with multiplicity, are shown as red, yellow, green, blue and violet respectively. The white line is a(n) = n. %e A373860 a(8) = 12 as a(7) = 9 is odd, and the most recently appearing odd number prior to a(7) is a(3) = 3, and 12 is the smallest unused positive number to share a factor with 3. %t A373860 c[_] := False; j = 4; nn = 120; q[_] := 0; m[_] := 1; %t A373860 Array[Set[{a[#], c[#]}, {#, True}] &, j]; q[0] = 4; q[1] = 3; u = 5; %t A373860 Do[If[EvenQ[j], %t A373860 If[PrimePowerQ[q[0]], k = m[2]; %t A373860 While[c[2 k], k++]; k *= 2; While[c[2 m[2]], m[2]++], %t A373860 k = u; While[Or[c[k], CoprimeQ[q[0], k]], k++]], %t A373860 If[PrimePowerQ[q[1]], %t A373860 (k = m[#]; While[c[k #], k++]; k *= #; %t A373860 While[c[# m[#]], m[#]++]) &[FactorInteger[q[1]][[1, 1]]], %t A373860 k = u; While[Or[c[k], CoprimeQ[q[1], k]], k++]] %t A373860 ]; q[Mod[j, 2]] = j; %t A373860 Set[{a[n], c[k], j}, {k, True, k}]; %t A373860 If[k == u, While[c[u], u++]], {n, j + 1, nn}]; %t A373860 Array[a, nn] (* _Michael De Vlieger_, Jun 20 2024 *) %o A373860 (Python) %o A373860 from math import gcd, lcm %o A373860 from itertools import count, islice %o A373860 def agen(): # generator of terms %o A373860 yield from [1, 2, 3, 4] %o A373860 aset, an, eo, mink = {1, 2, 3, 4}, 4, [2, 3], 5 %o A373860 while True: %o A373860 s, prevan = eo[an%2], an %o A373860 an = next(k for k in count(mink) if k not in aset and gcd(s,k)>1) %o A373860 eo[prevan%2] = prevan %o A373860 aset.add(an) %o A373860 while mink in aset: mink += 1 %o A373860 yield an %o A373860 print(list(islice(agen(), 77))) # _Michael S. Branicky_, Jun 20 2024 %Y A373860 Cf. A373623, A373546, A064413, A373545, A064413, A005843, A005408. %K A373860 nonn %O A373860 1,2 %A A373860 _Scott R. Shannon_, Jun 19 2024