OFFSET
1,2
COMMENTS
A weak abelian square is a word w that can be written as x x' for nonempty strings x, x' such that the relative frequency of occurrences of each letter is the same in the blocks x and x'. For example, 011100 is a weak abelian square, as it can be written (01)(1100) and in each block both 0 and 1 occur 50% of the time.
LINKS
Sergey Avgustinovich and Svetlana Puzynina, Weak abelian periodicity of infinite words, preprint, 18 Feb 2013, arXiv:1302.4359 [math.CO].
EXAMPLE
The weak abelian squares of length 4 are 0000, 0101, 0110, 1001, 1010, 1111. Therefore a(4)=6.
PROG
(PARI) a(n)=s=0; for(m=0, 2^n-1, b=binary(m); bl=#b; b=vector(n, i, if(i<=n-bl, 0, b[i-(n-bl)])); h=hammingweight(b); bl=#b; ss=0; for(i=1, bl-1, ss=ss+b[i]; if(ss/i==(h-ss)/(bl-i), s=s+1; break))); s /* Ralf Stephan, Oct 17 2013 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Oct 16 2013
EXTENSIONS
a(22)-a(39) from Lars Blomberg, Jan 27 2016
STATUS
approved