|
|
A191755
|
|
Number of square binary words: binary words of length 2n obtained by self-shuffling.
|
|
10
|
|
|
1, 2, 6, 22, 82, 320, 1268, 5102, 20632, 83972, 342468, 1399296, 5720966, 23396618, 95654386, 390868900, 1596000418, 6511211718, 26538617050, 108060466284
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Self-shuffle means shuffle of word with itself, and shuffle means "not-necessarily-perfect shuffle". In other words, the shuffle of two strings x and y is the set of strings obtained by scanning left-to-right through the strings, choosing arbitrarily at each step a symbol from x or y.
See A192296 for the number of ternary words of length 2n obtained by self-shuffling.
|
|
LINKS
|
|
|
EXAMPLE
|
a(2) = 6 because {0000, 0011, 0101, 1010, 1100, 1111} are all generated by self-shuffling.
|
|
PROG
|
(Python)
from itertools import product, combinations
if n<=1: return 2**n, 1, '0'*n
range2n, set2n = list(range(2*n)), set(range(2*n))
allset, mx, argmx, ssw = set(), -1, None, [0 for i in range(2*n)]
for w in product("01", repeat=n-1):
w, sswset = "0" + "".join(w), set()
for s in combinations(range2n, n):
nots = sorted(set2n-set(s))
for i, c in enumerate(w): ssw[s[i]] = ssw[nots[i]] = c
sswset.add("".join(ssw))
allset |= sswset
if len(sswset) > mx: mx, argmx = len(sswset), w
return 2*len(allset), mx, argmx
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,hard,more,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
a(0)-a(9) confirmed and a(10)-a(13) added by John W. Layman, Jun 28 2011
|
|
STATUS
|
approved
|
|
|
|