%I #26 Apr 06 2024 10:03:00
%S 1,2,4,6,10,14,22,26,38,42,58,62,78,82,110,106,130,134,166,162,190,
%T 190,238,226,254,250,318,294,330,330,378,366,418,406,490,430,486,486,
%U 586,538,570,574,650,618,690,646,786,714,766,742,870,818,890,858,966,874,970
%N Number of length-n strongly factor-symmetric binary words.
%C Suppose w is a word with p 0's and q 1's. Let d(i,j) denote the number of distinct blocks in w having exactly i 0's and j 1's, for 0<=i<=p and 0<=j<=q. Then w is said to be strongly factor symmetric if d(p-i,q-j) = d(i,j) for all i and j.
%C a(n) is even for n > 0 by symmetry. - _Michael S. Branicky_, Apr 04 2024
%H Bert Dobbelaere, <a href="/A371719/b371719.txt">Table of n, a(n) for n = 0..120</a>
%e For example, for n = 5, the word 00101 is strongly-factor symmetric.
%o (Python)
%o from itertools import product
%o from collections import defaultdict
%o def sfs(w): # is strongly factor symmetric
%o p, q, d = w.count('0'), w.count('1'), defaultdict(lambda: set())
%o d[0, 0] = set([""])
%o for b in range(len(w)):
%o for e in range(b+1, len(w)+1):
%o i, j = w[b:e].count('0'), w[b:e].count('1')
%o d[i, j].add(w[b:e])
%o return all(len(d[p-i, q-j])==len(d[i, j]) for i in range(p+1) for j in range(q+1))
%o def a(n):
%o if n == 0: return 1
%o return 2*sum(1 for w in product("01", repeat=n-1) if sfs("0"+"".join(w)))
%o print([a(n) for n in range(17)]) # _Michael S. Branicky_, Apr 04 2024
%K nonn
%O 0,2
%A _Jeffrey Shallit_, Apr 04 2024
%E a(21)-a(27) from _Michael S. Branicky_, Apr 04 2024
%E a(28)-a(56) from _Bert Dobbelaere_, Apr 06 2024