OFFSET
1,1
COMMENTS
The longest repeated suffix of a word x is the longest suffix (possibly empty) that occurs at least twice as a contiguous block inside x, and analogously for the prefix.
LINKS
Michael S. Branicky, Python program.
EXAMPLE
For n = 5 these binary words are 00000, 00100, 00110, 01001, 01010, 01100, 01101, 01110 and their reversals.
PROG
(Python) # see link for faster version
from itertools import product
def lrp(s): # longest repeated prefix (overlaps allowed)
for i in range(len(s)-1, 0, -1):
if s.find(s[:i], 1) >= 0: return s[:i]
return ""
def a(n):
if n == 1: return 2
c = 0
for p in product("01", repeat=n-1):
b = "1" + "".join(p)
if lrp(b) == lrp(b[::-1])[::-1]: c += 1
return 2*c
print([a(n) for n in range(1, 17)]) # Michael S. Branicky, Feb 05 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Sep 16 2019
EXTENSIONS
a(29) and beyond from Michael S. Branicky, Feb 05 2021
STATUS
approved