cp's OEIS Frontend

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.

A373998 a(1) = 1, a(2) = 2, a(3) = 3, a(4) = 5; for n > 4, a(n) is the smallest unused positive number that is coprime to a(n-1) and a(n-2) but has a common factor with at least one of a(1)...a(n-3).

This page as a plain text file.
%I A373998 #13 Jun 24 2024 16:47:25
%S A373998 1,2,3,5,4,9,25,8,21,55,16,7,11,6,35,121,12,49,65,18,77,13,10,27,91,
%T A373998 20,33,119,26,15,17,14,39,85,22,57,115,28,19,23,24,95,143,32,45,133,
%U A373998 34,69,125,38,51,145,44,63,29,40,81,161,50,87,169,46,75,187,52,93,175,58,31,99,56,155
%N A373998 a(1) = 1, a(2) = 2, a(3) = 3, a(4) = 5; for n > 4, a(n) is the smallest unused positive number that is coprime to a(n-1) and a(n-2) but has a common factor with at least one of a(1)...a(n-3).
%C A373998 For the terms studied, and similar to A373390 and A089088, the terms are concentrated along distinct lines of different gradient, four in this sequence, and like those sequences, the lowermost line is composed only of primes.
%C A373998 Note that in A089088, A373390, and this sequence, a(n) is coprime to zero, one and two previous terms, and the corresponding sequence terms are concentrated along two, three and four lines respectively.
%C A373998 The fixed points are 1, 2, 3, 8, 45, 51, and it is likely no more exist. For the terms studied the primes appear in their natural order. The sequence is conjectured to be a permutation of the positive integers.
%H A373998 Scott R. Shannon, <a href="/A373998/b373998.txt">Table of n, a(n) for n = 1..10000</a>
%H A373998 Scott R. Shannon, <a href="/A373998/a373998.png">Image of the first 50000 terms</a>. Numbers with one, two, three, four, or five and more prime factors, counted with multiplicity, are show as red, yellow, green, blue and violet respectively.
%e A373998 a(7) = 25 as 25 is the smallest unused number that is coprime to a(5) = 4 and a(6) = 9 while sharing a factor with a(4) = 5.
%o A373998 (Python)
%o A373998 from math import gcd, lcm
%o A373998 from itertools import count, islice
%o A373998 def agen(): # generator of terms
%o A373998     alst = [1, 2, 3, 5]
%o A373998     yield from alst
%o A373998     aset, LCM, mink = set(alst), lcm(*alst[:-2]), 4
%o A373998     while True:
%o A373998         an = next(k for k in count(mink) if k not in aset and 1 == gcd(k, alst[-1]) == gcd(k, alst[-2]) and gcd(k, LCM) > 1)
%o A373998         LCM = lcm(LCM, alst[-2])
%o A373998         alst.append(an)
%o A373998         aset.add(an)
%o A373998         while mink in aset: mink += 1
%o A373998         yield an
%o A373998 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Jun 24 2024
%Y A373998 Cf. A373999, A373390, A089088, A064413, A098550,  A373880.
%K A373998 nonn
%O A373998 1,2
%A A373998 _Scott R. Shannon_, Jun 24 2024