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.

A370577 Lexicographically earliest sequence such that for any value m, the number of distinct values between a pair of consecutive m's is distinct.

This page as a plain text file.
%I A370577 #13 Feb 25 2024 10:14:59
%S A370577 1,1,2,1,2,2,3,1,2,3,3,4,1,2,3,4,3,4,4,5,1,2,3,4,5,5,6,1,2,3,4,5,6,4,
%T A370577 5,6,5,6,6,7,1,2,3,4,5,6,7,7,8,1,2,3,4,5,6,7,8,5,6,7,8,7,8,8,9,1,2,3,
%U A370577 4,5,6,7,8,9,7,8,9,9,10,1,2,3,4,5,6,7
%N A370577 Lexicographically earliest sequence such that for any value m, the number of distinct values between a pair of consecutive m's is distinct.
%H A370577 Michael S. Branicky, <a href="/A370577/b370577.txt">Table of n, a(n) for n = 1..10000</a>
%e A370577 The first terms with the number of distinct values enclosed by m = 1..4 below:
%e A370577    n|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
%e A370577 ...
%e A370577 a(n)|  1  1  2  1  2  2  3  1  2  3  3  4  1  2  3  4  3  4  4  5  1  2  3
%e A370577 ...
%e A370577 ----+---------------------------------------------------------------------
%e A370577  1's|     0,    1,          2,             3,                      4,
%e A370577 ...
%e A370577  2's|              1, 0,       2,             3,                      4,
%e A370577 ...
%e A370577  3's|                             2, 0,          3,    1,                4,
%e A370577 ...
%e A370577  4's|                                               3,    1, 0,
%e A370577 ...
%o A370577 (Python)
%o A370577 from itertools import islice
%o A370577 def agen(): # generator of terms
%o A370577     e, a = set(), []
%o A370577     while True:
%o A370577         an, allnew = 0, False
%o A370577         while not allnew:
%o A370577             allnew, an, nd = True, an+1, None
%o A370577             for i in range(len(a)-1, -1, -1):
%o A370577                 if an == a[i]:
%o A370577                     nd = len(set(a[i+1:]))
%o A370577                     if (an, nd) in e: allnew = False
%o A370577                     break
%o A370577         yield an; a.append(an); e.add((an, nd))
%o A370577 print(list(islice(agen(), 86))) # _Michael S. Branicky_, Feb 22 2024
%Y A370577 Cf.A330896, A366691, A281511.
%K A370577 nonn
%O A370577 1,3
%A A370577 _Neal Gersh Tolunsky_, Feb 22 2024
%E A370577 More terms from _Michael S. Branicky_, Feb 22 2024