OFFSET
1,1
COMMENTS
A square is a word of the form XX, where X is a nonempty block.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..39
Rémy Sigrist, C program for A323443
EXAMPLE
For n = 7 the squares are (0100001)^2, (0100110)^2, (0110001)^2, (0110010)^2, (0111001)^2, (0111101)^2, (0111110)^2 and their complements.
PROG
(C) See Links section.
(Python)
from itertools import product as prod
def c(w): # string ww begins or ends with a shorter square
ww = w+w
if any(ww[:i] == ww[i:2*i] for i in range(1, len(w))): return True
if any(ww[-i:] == ww[-2*i:-i] for i in range(1, len(w))): return True
return False
def a(n):
return sum(2 for b in prod("01", repeat=n-1) if not c("0"+"".join(b)))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Jul 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Jan 15 2019
EXTENSIONS
More terms from Rémy Sigrist, Jan 19 2019
STATUS
approved