OFFSET
1,2
COMMENTS
The palindromic length of a sequence is the minimum number of terms needed to write it as a concatenation of palindromes. For example, 011010 has palindromic length 3, as it can be written as (0110)(1)(0) or (0)(11)(010), but there is no way to write it as the concatenation of two palindromes.
The profile is the list of palindromic lengths of all prefixes. For 011010 it is (1,2,2,1,2,3). This sequence counts the distinct profiles.
LINKS
Anna E. Frid, Prefix palindromic length of the Thue-Morse word, arXiv:1906.09392 [cs.DM], 2019.
PROG
(Python)
from functools import lru_cache
from itertools import product
def ispal(w): return w == w[::-1]
@lru_cache(maxsize=None)
def pal_len(w):
if len(w) <= 1: return len(w)
return min(1+pal_len(w[i:]) for i in range(len(w), 0, -1) if ispal(w[:i]))
def plp(w): # palindrome length profile
return tuple(pal_len(w[:i]) for i in range(1, len(w) + 1))
def a(n): # only search strings starting with 0 by symmetry
return len(set(plp("0"+"".join(u)) for u in product("01", repeat=n-1)))
print([a(n) for n in range(1, 18)]) # Michael S. Branicky, Jan 04 2021
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Jeffrey Shallit, Jan 04 2021
EXTENSIONS
a(21)-a(26) from Michael S. Branicky, Jan 04 2021
STATUS
approved