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.

A381873 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that shares a factor with a(n-1) while containing at most two distinct prime factors.

This page as a plain text file.
%I A381873 #21 May 25 2025 16:07:07
%S A381873 1,2,4,6,3,9,12,8,10,5,15,18,14,7,21,24,16,20,22,11,33,27,36,26,13,39,
%T A381873 45,25,35,28,32,34,17,51,48,38,19,57,54,40,44,46,23,69,63,49,56,50,52,
%U A381873 58,29,87,72,62,31,93,75,55,65,80,64,68,74,37,111,81
%N A381873 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that shares a factor with a(n-1) while containing at most two distinct prime factors.
%C A381873 Like the EKG sequence A064413 for the terms studied the primes appear in their natural order, although unlike A064413 some primes p are preceded by 3*p and followed by 2*p. The first time this occurs is a(682) = 1401, a(683) = 467, a(684) = 934, although as n increases this becomes more common.
%C A381873 The primes are all contained in the lowest line of values which has up upward curvature - see the attached image. This leads to it crossing the line a(n) = n and creating the fixed point a(15527). The only other fixed points are 1, 2, 8 and 40, and it is likely no more exist.
%C A381873 No further fixed points through a(8*10^5). - _Michael S. Branicky_, Mar 10 2025
%H A381873 Scott R. Shannon, <a href="/A381873/b381873.txt">Table of n, a(n) for n = 1..10000</a>
%H A381873 Scott R. Shannon, <a href="/A381873/a381873.png">Image of the first 30000 terms</a>. The green line is a(n) = n.
%e A381873 a(23) = 36 = 2^2*3^3 as a(22) = 27 and 36 is unused and shares a factor with 27 while containing two distinct prime factors. Note that 30 = 2*3*5 cannot be chosen as it contains three distinct prime factors; this is the first term to differ from A064413.
%o A381873 (Python)
%o A381873 from math import gcd
%o A381873 from sympy import factorint
%o A381873 from functools import cache
%o A381873 from itertools import count, islice
%o A381873 @cache
%o A381873 def omega(n): return len(factorint(n))
%o A381873 def agen(): # generator of terms
%o A381873     yield 1
%o A381873     aset, an, m = {1}, 2, 3
%o A381873     while True:
%o A381873         yield an
%o A381873         aset.add(an)
%o A381873         an = next(k for k in count(m) if k not in aset and gcd(an, k) > 1 and omega(k) <= 2)
%o A381873         while m in aset or omega(m) > 2: m += 1
%o A381873 print(list(islice(agen(), 66))) # _Michael S. Branicky_, Mar 09 2025
%Y A381873 Cf. A070915, A027748, A000977, A064413.
%K A381873 nonn,look
%O A381873 1,2
%A A381873 _Scott R. Shannon_, Mar 09 2025