OFFSET
1,3
COMMENTS
Every positive integer occurs infinitely many times in the sequence.
The multiset between any two equal terms is unique. For example: once consecutive values "A B C A" occur, both "D B C D" and "D C B D" can never occur, because the multiset "B C" would be repeated between equal terms.
Two consecutive values enclose the empty multiset. For this reason, after [a(1), a(2)] = [1, 1], no consecutive equal values will occur again.
A new value is always followed by 1.
The sequence first differs from A366624 at a(15).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..7522
Samuel Harkness, MATLAB program.
Neal Gersh Tolunsky, Ordinal Transform of 5000 terms.
EXAMPLE
a(15) = 5: a(15) cannot be 1 since this would form the empty multiset with a(14) = 1. a(15) cannot be 2 because this would form the multiset [2 1 2] = {1}, which already occurred at [2 1 2] = {1}. a(15) cannot be 3 because this would form the multiset [3 2 1 3] = {1, 2}, which already occurred at [1 1 2 1] = {1, 2}. a(15) cannot be 4 because this would form the multiset [4 1 2 3 2 1 4] = {1, 1, 2, 2, 3}, which already occurred at [1 1 2 1 2 3 1] = {1, 1, 2, 2, 3}. a(15) = 5 because 5 is a first occurrence and thus creates no new multisets.
For this sequence, the multisets between k and all other occurrences of k must be checked. The first instance such that this is the sole reason for restricting a possible value is when considering 2 for a(27).
a(27) != 2 since 2 there would cause two enclosed multisets with the same 5 terms (in different order, which doesn't matter for a multiset),
n = 15 19 22 26 27
a(n) = 1 5 1 2 3 4 1 2 3 4 2 1 5 [2]
|-------| |-------|
There are also instances where overlapping conflicting regions are the sole reason for restricting a possible value.
a(74) != 5 since 5 there would cause two enclosed multisets with the same 20 terms,
n = 38 54
a(n) = 2 6 1 2 3 4 5 1 2 4 3 7 1 2 3 4 5 3 1
|----------------------------------
|--
n = 57 73
a(n) = 2 6 2 1 3 4 5 7 1 2 3 4 5 6 1 2 3 4[5]
--|
----------------------------------|
PROG
(MATLAB) See Links section.
(Python)
from itertools import islice
def agen(): # generator of terms
m, a = set(), []
while True:
an, allnew = 0, False
while not allnew:
allnew, an, mn = True, an+1, set()
for i in range(len(a)):
if an == a[i]:
t = tuple(sorted(a[i+1:]))
if t in m or t in mn: allnew = False; break
mn.add(t)
yield an; a.append(an); m |= mn
print(list(islice(agen(), 87))) # Michael S. Branicky, Oct 25 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Samuel Harkness, Oct 14 2023
STATUS
approved