OFFSET
1,1
LINKS
Max Alekseyev, Table of n, a(n) for n = 1..100
Michael S. Branicky, Python program
EXAMPLE
The two halves of 011001 are 011 and 001. Their complements are 100 and 110, and both are substrings of 011001. Since there are 11 other strings of length 2*3 with this property, a(3) = 12.
MATHEMATICA
sQ[L_, {s__}] := MatchQ[L, {___, s, ___}]; a[n_] := Length@ Select[ Tuples[{0, 1}, 2@n], sQ[#, 1-Take[#, n]] && sQ[#, 1-Take[#, -n]] &]; Array[a, 8]
PROG
(Python) # see link for faster version
from itertools import product as prod
def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z})
def ok(s): return comp(s[:len(s)//2]) in s and comp(s[len(s)//2:]) in s
def a(n): return 2*sum(ok("0"+"".join(p)) for p in prod("01", repeat=2*n-1))
print([a(n) for n in range(1, 12)]) # Michael S. Branicky, Feb 06 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Giovanni Resta, Feb 08 2014
EXTENSIONS
a(17)-a(21) from Michael S. Branicky, Feb 06 2021
a(22) from Michael S. Branicky, Jul 06 2022
a(23) from Michael S. Branicky, Jul 25 2022
Terms a(24) onward from Max Alekseyev, Jul 23 2024
STATUS
approved