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.

A370822 Lexicographically earliest sequence of positive integers such that all equal terms appear at mutually coprime indices.

This page as a plain text file.
%I A370822 #20 Mar 06 2024 04:44:30
%S A370822 1,1,1,2,1,3,1,4,2,5,1,6,1,7,4,8,1,9,1,10,5,11,1,12,2,13,7,14,1,15,1,
%T A370822 16,8,17,3,18,1,19,10,20,1,21,1,22,11,23,1,24,2,25,13,26,1,27,6,28,14,
%U A370822 29,1,30,1,31,16,32,7,33,1,34,17,35,1,36,1,37,19
%N A370822 Lexicographically earliest sequence of positive integers such that all equal terms appear at mutually coprime indices.
%C A370822 See A279119 for the same sequence with numbers including 0.
%C A370822 See A055396 for a similar sequence where all equal terms share a factor > 1.
%H A370822 Michael S. Branicky, <a href="/A370822/b370822.txt">Table of n, a(n) for n = 1..10000</a>
%F A370822 a(n) = 1 + A279119(n). - _Rémy Sigrist_, Mar 04 2024
%e A370822 a(4)=2 because if we had a(4)=1, then i=2 and i=4, which are not coprime indices, would have the same value 1. So a(4)=2, which is a first occurrence.
%e A370822 a(9)=2 because if we had a(9)=1, i=3 and i=9, would have the same value despite not being coprime indices. a(9) can be 2 because the only other index with a 2 is a(4)=2 and 4 is coprime to 9.
%e A370822 a(15)=4 because 4 is the smallest value such that every previous index at which a 4 occurs is coprime to i=15. In this case, 4 has only occurred at i=8 and 8 is coprime to 15.
%o A370822 (Python)
%o A370822 from math import gcd, lcm
%o A370822 from itertools import combinations as C, count, islice
%o A370822 def agen(): # generator of terms
%o A370822     yield from [1, 1, 1]
%o A370822     lcms = {1: 6}
%o A370822     for n in count(4):
%o A370822         an = next(an for an in count(1) if an not in lcms or gcd(lcms[an], n) == 1)
%o A370822         yield an
%o A370822         if an not in lcms: lcms[an] = n
%o A370822         else: lcms[an] = lcm(lcms[an], n)
%o A370822 print(list(islice(agen(), 75))) # _Michael S. Branicky_, Mar 02 2024
%Y A370822 Cf. A100480, A279119, A370408.
%K A370822 nonn
%O A370822 1,4
%A A370822 _Neal Gersh Tolunsky_, Mar 02 2024
%E A370822 a(22) and beyond from _Michael S. Branicky_, Mar 02 2024