OFFSET
1,1
COMMENTS
A square is a nonempty block of the form XX.
LINKS
Michael S. Branicky, Python program
EXAMPLE
For n = 6 the 12 solutions are {000001, 000011, 000111, 001011, 001111, 011111} and their complements.
PROG
(Python) # see links for a faster, bit-based version
from itertools import product
def issquare(w):
if len(w) == 0 or len(w)%2 == 1: return False
return w[:len(w)//2] == w[len(w)//2:]
def c(b):
for leny in range(len(b)-2, 0, -2):
for offset in range(1, len(b)-leny):
if issquare(b[:offset] + b[offset+leny:]):
return False
return not issquare(b)
def a(n):
return 2*sum(1 for b in product("01", repeat=n-1) if c("1"+"".join(b)))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Dec 07 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Jan 15 2019
EXTENSIONS
a(21)-a(33) from Lars Blomberg, Jan 26 2019
a(32)-a(33) corrected and a(34)-a(40) from Michael S. Branicky, Dec 07 2021
STATUS
approved