OFFSET
0,2
EXAMPLE
For example, the run-lengths in 1333 are 13, then the run-lengths of this is 11, then the run-lengths of this is 2, then the run-lengths of this is 1, so this sequence is counted in a(4).
PROG
(Python)
from itertools import groupby, product
def r(w):
return [len(list(g)) for k, g in groupby(w)]
def c(w):
while (rw:=r(w)) != w:
if not set(rw) <= {1, 2, 3}: return False
w = rw
return True
def a(n):
if n == 0: return 1
return 3*sum(1 for w in product((1, 2, 3), repeat=n-1) if c((1, )+w))
print([a(n) for n in range(14)]) # Michael S. Branicky, Jan 06 2026
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Jeffrey Shallit, Oct 01 2010
EXTENSIONS
a(0)-a(10) confirmed and a(11)-a(14) added by John W. Layman, Oct 07 2010
a(15)-a(16) from Alois P. Heinz, Oct 16 2011
a(17)-a(22) from Michael S. Branicky, Jan 06 2026
STATUS
approved
