[go: up one dir, main page]

login
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, 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,3
COMMENTS
The word 'set' means that every element is unique. For example, the set {1,1,2} contains 2 elements (not 3).
Note that we are considering sets between every pair of equal values, not just those that appear consecutively.
Two consecutive values enclose 1 term, and thus after [a(1), a(2)] = [1, 1], no consecutive equal values occur again.
LINKS
EXAMPLE
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.
PROG
(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
CROSSREFS
Cf. A366691.
Sequence in context: A026409 A336215 A243290 * A085238 A214371 A026338
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Nov 26 2024
STATUS
approved