%I #12 Jan 14 2020 00:54:14
%S 1,0,1,0,1,0,1,0,1,0,1,2,1,0,1,0,1,0,1,2,1,2,3,0,3,2,1,2,1,0,1,0,1,0,
%T 1,2,1,2,3,0,3,4,3,2,5,2,3,6,3,2,5,2,3,4,3,0,3,2,1,2,1,0,1,0,1,0,1,2,
%U 1,2,3,0,3,4,3,2,5,2,3,6,3,4,7,2,7,6,5
%N a(n) is the number of ways to write n = u + v where the binary representations of u and of v have the same number of 0's and the same number of 1's.
%C In other words, a(n) is the number of ways to write n as the sum of two binary anagrams.
%C Leading zeros are ignored.
%H Rémy Sigrist, <a href="/A331216/b331216.txt">Table of n, a(n) for n = 0..16384</a>
%H Rémy Sigrist, <a href="/A331216/a331216.gp.txt">PARI program for A331216</a>
%H Rémy Sigrist, <a href="/A331216/a331216.png">Scatterplot of (x, y) such that 0 <= x, y <= 2^10 and x and y are binary anagrams</a> (a(n) corresponds to the number of pixels (x, y) such that x+y = n)
%F a(2*n) > 0.
%F a(2*n) >= a(n).
%F Apparently, a(3*2^k-1-x) = a(3*2^k-1+x) for any k >= 0 and x = -2^k..2^k.
%e For n = 22:
%e - we can write 22 as u + v in the following ways:
%e u v bin(u) bin(v)
%e -- -- ------ ------
%e 10 12 1010 1100
%e 11 11 1011 1011
%e 12 10 1100 1010
%e - hence a(22) = 3.
%o (PARI) See Links section.
%Y Cf. A330827 (ternary analog), A331218 (decimal analog).
%K nonn,base
%O 0,12
%A _Rémy Sigrist_, Jan 12 2020