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 A377078 #17 Oct 19 2024 10:49:39 %S A377078 2,3,4,6,8,9,10,12,5,14,15,16,18,20,21,22,24,11,26,33,13,7,27,28,30, %T A377078 32,25,35,40,42,34,36,17,38,51,19,39,57,45,46,48,23,44,69,50,76,52,54, %U A377078 56,58,49,60,63,55,62,65,31,66,93,64,29,68,87,70,85,72,78,74,80,37,75,111,81,82,84,41,86,123,43,148,129,95,88,77,99,91,92,98,90,94 %N A377078 Lexicographically earliest infinite sequence of distinct positive integers such that, for n > 2, a(n) shares a factor with a(n-2) mod a(n-1). %C A377078 To ensure the sequence is infinite a(n) must be chosen so that a(n-1) mod a(n) is not 0 or 1. In the first 100000 terms the fixed points are 119, 205, 287, and it is likely no more exist. It is conjectured all numbers > 1 appear in the sequence. %H A377078 Scott R. Shannon, <a href="/A377078/b377078.txt">Table of n, a(n) for n = 1..10000</a> %H A377078 Scott R. Shannon, <a href="/A377078/a377078.png">Image of the first 100000 terms</a>. The green line is a(n) = n. %e A377078 a(4) = 6 as a(2) mod a(3) = 3 mod 4 = 3, and 6 is the earliest unused number that shares a factor with 3. %e A377078 a(12) = 16 as a(10) mod a(11) = 14 mod 15 = 14, and 16 shares a factor with 14. Note that 7 is unused and shares a factor with 14 but a(11) mod 7 = 1, so choosing a(12) = 7 would mean a(13) would not exist. %t A377078 a[1] = 2; a[2] = 3; hs = {a[1], a[2]}; pool = Range[4, 1000]; %t A377078 a[n_] := a[n] = Module[{m, pos}, pool = Complement[pool, hs];m = Mod[a[n - 2], a[n - 1]]; pos = FirstPosition[pool, _?(Mod[a[n - 1], #] > 1 && GCD[#, m] > 1 &)][[1]]; AppendTo[hs, pool[[pos]]]; pool[[pos]]] %t A377078 Array[a, 90, 1] (* _Shenghui Yang_, Oct 16 2024*) %o A377078 (Python) %o A377078 from math import gcd %o A377078 from itertools import count, islice %o A377078 def agen(): # generator of terms %o A377078 an2, an1, aset, m = 2, 3, {2, 3}, 4 %o A377078 yield from [2, 3] %o A377078 while True: %o A377078 t = an2%an1 %o A377078 an = next(k for k in count(m) if k not in aset and an1%k > 1 and gcd(k, t) > 1) %o A377078 yield an %o A377078 aset.add(an) %o A377078 while m in aset: m += 1 %o A377078 an2, an1 = an1, an %o A377078 print(list(islice(agen(), 90))) # _Michael S. Branicky_, Oct 15 2024 %Y A377078 Cf. A064413, A359557, A270139, A027749. %K A377078 nonn %O A377078 1,1 %A A377078 _Scott R. Shannon_, Oct 15 2024