OFFSET
1,2
COMMENTS
Terms are even by symmetry. - Michael S. Branicky, Jul 28 2021
EXAMPLE
a(4) = 4, because {0011, 0110, 1001, 1100} have unique factorizations into palindromes of length >= 2.
PROG
(Python)
from functools import lru_cache
from itertools import product
def ispal(s): return s == s[::-1]
@lru_cache(maxsize=None)
def f(b): # factorizations of binary string b
factorizations = int(len(b) >= 2 and ispal(b))
for i in range(2, len(b)-1):
factorizations += ispal(b[:i]) * f(b[i:])
if factorizations >= 2: return 2 # short circuit on condition
return factorizations
def a(n):
return 2*sum(f("0"+"".join(b))==1 for b in product("01", repeat=n-1))
print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Jul 28 2021
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Jeffrey Shallit, Apr 17 2014
EXTENSIONS
a(17)-a(30) from Giovanni Resta, Apr 18 2014
a(31)-a(32) from Michael S. Branicky, Jul 28 2021
STATUS
approved