|
|
A323595
|
|
Number of distinct sets of lengths of nonempty palindrome prefixes, over all binary words of length n.
|
|
0
|
|
|
1, 2, 4, 6, 10, 14, 21, 28, 39, 51, 69, 86, 111, 138, 176, 214, 264, 315, 385, 454, 546, 641, 763, 881, 1032, 1188, 1385, 1580, 1824, 2066, 2371, 2668, 3037, 3413, 3869, 4310, 4846, 5387, 6045
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
EXAMPLE
|
For n = 4, the 6 possible sets are:
{1}, corresponding to 0111.
{1,2}, corresponding to 0011.
{1,3}, corresponding to 0101.
{1,4}, corresponding to 0110.
{1,2,3}, corresponding to 0001.
{1,2,3,4}, corresponding to 0000.
|
|
PROG
|
(Python)
from itertools import product
def ispal(w): return w == w[::-1]
def pls(w): return tuple(i for i in range(len(w)) if ispal(w[:i+1]))
def a(n): # only search strings starting with 0 by symmetry
return len(set(pls("0"+"".join(u)) for u in product("01", repeat=n-1)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|