A378381 Lexicographically earliest sequence such that each set of terms enclosed by two equal values, including the endpoints, contains a distinct number of elements.
1, 1, 2, 3, 2, 4, 3, 5, 6, 4, 7, 3, 8, 9, 5, 10, 6, 11, 12, 7, 13, 3, 14, 15, 16, 8, 17, 9, 18, 5, 19, 20, 10, 21, 6, 22, 23, 11, 24, 12, 25, 26, 13, 27, 3, 28, 29, 30, 31, 14, 32, 15, 33, 16, 34, 8, 35, 36, 17, 37, 9, 38, 39, 18, 40, 5, 41, 42, 43, 19, 44, 20, 45
Offset: 1
Keywords
Examples
a(4) cannot be 1 since this would create a second pair enclosing two values, [1,2,1] being an equivalent set to [1,2,1,1]. We cannot have a(4)=2 because [1,2,1] would enclose the same number of elements as [2,1,2]. So a(4)=3, which has not occurred before.
Links
- Neal Gersh Tolunsky, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A366691.
Programs
-
Python
from itertools import islice def agen(): # generator of terms e, a = set(), [] while True: an, allnew = 0, False while not allnew: allnew, an, ndset = True, an+1, set() for i in range(len(a)): if an == a[i]: nd = len(set(a[i:])) if nd in e or nd in ndset: allnew = False; break ndset.add(nd) yield an; a.append(an); e |= ndset print(list(islice(agen(), 73))) # Michael S. Branicky, Nov 26 2024
Comments