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 A379165 #16 Jan 03 2025 04:26:46 %S A379165 1,2,3,5,4,7,9,8,6,10,11,13,12,17,19,14,15,18,20,16,21,23,22,25,27,26, %T A379165 24,28,29,31,30,37,41,32,33,35,34,39,36,42,38,40,43,47,44,45,48,49,53, %U A379165 46,51,54,55,50,57,59,52,61,63,58,56,60,62,64,65,67,66,71,73,68,69,72,75,70,78,74,76,77,79,80,81,83,82,85,87,86,84,88,89,91 %N A379165 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that is either coprime to both a(n-1) and a(n-2) or shares a factor with both a(n-1) and a(n-2). %C A379165 For the terms studied the primes appear in their natural order. The fixed points being 3, 8, 10, 11, 18, 21, 26, 28, 29, 43, 51, 64... . After 10 million terms 3211449 of them, approximately 32.1%, share a factor with both previous terms - it is unknown what this ratio is as n -> infinity. The sequence is almost certainly a permutation of the positive numbers. %H A379165 Scott R. Shannon, <a href="/A379165/b379165.txt">Table of n, a(n) for n = 1..10000</a> %e A379165 a(4) = 5 as 5 is coprime to both a(3) = 3 and a(2) = 2, and 5 has not previously appeared. %e A379165 a(9) = 6 as 6 shares a factor with both a(8) = 8 and a(7) = 9, and 6 has not previously appeared. %t A379165 nn = 120; c[_] := False; Do[Set[{a[n], c[k]}, {n, True}], {n, 2}]; %t A379165 i = a[1]; j = a[2]; u = 3; %t A379165 Do[k = u; %t A379165 While[Or[c[k], Nor[And[#1, #2], Nor[#1, #2]]] &[ %t A379165 CoprimeQ[k, i], CoprimeQ[k, j]], k++]; %t A379165 Set[{a[n], c[k], i, j}, {k, True, j, k}]; %t A379165 If[k == u, While[c[u], u++]], {n, 3, nn}]; %t A379165 Array[a, nn] (* _Michael De Vlieger_, Dec 17 2024 *) %Y A379165 Cf. A379166, A353239, A098550, A336957, A064413. %K A379165 nonn %O A379165 1,2 %A A379165 _Scott R. Shannon_, Dec 17 2024