login
A396726
Greatest frequency depth of a word of length n.
0
1, 3, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11
OFFSET
1,2
COMMENTS
The frequency depth of a sequence is the number of iterations of the run transform on a sequence required to reach 1. See A327662 for an equivalent definition using different terms.
Note that we only need to consider sequences consisting of 1s and 2s (or any two values, which serve to delineate the start and end of a run).
EXAMPLE
a(5) is 6 because the greatest number of iterations of the run transform before a sequence of length 5 reaches 1 is 6. For example, 1,2,2,1,2 -> 1,2,1,1 -> 1,1,2 -> 2,1 -> 1,1 -> 2 -> 1. This is 6 steps (the most we can get), so a(5) = 6.
PROG
(Python)
from itertools import groupby, product
def RT(t): # run transform of tuple t
return tuple(len(list(g)) for k, g in groupby(t))
def f(t):
i = 0
while t != (1, ): t, i = RT(t), i+1
return i
def a(n):
return max(f((2, )+t) for t in product((1, 2), repeat=n-1))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Jun 03 2026
CROSSREFS
Sequence in context: A133575 A230113 A390458 * A364528 A217031 A104136
KEYWORD
nonn,more
AUTHOR
Neal Gersh Tolunsky, Jun 03 2026
EXTENSIONS
a(22)-a(31) from Michael S. Branicky, Jun 03 2026
STATUS
approved