login
Number of partitions of n into two parts whose xor-sum is n.
4

%I #21 Dec 04 2016 19:20:44

%S 0,0,0,1,0,1,1,3,0,1,1,3,1,3,3,7,0,1,1,3,1,3,3,7,1,3,3,7,3,7,7,15,0,1,

%T 1,3,1,3,3,7,1,3,3,7,3,7,7,15,1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31,0,

%U 1,1,3,1,3,3,7,1,3,3,7,3,7,7,15,1,3,3,7

%N Number of partitions of n into two parts whose xor-sum is n.

%F a(0) = 0, a(n) = A001316(n-m)-1, where m is the highest power of 2 less than n. - _Emmanuele Villa_, Nov 19 2016

%F a(2*n) = a(n), a(2*n + 1) = 2*a(n) + 1. - _Michael Somos_, Dec 04 2016

%e G.f. = x^3 + x^5 + x^6 + 3*x^7 + x^9 + x^10 + 3*x^11 + x^12 + 3*x^13 + 3*x^14 + ...

%e From _Emmanuele Villa_, Nov 19 2016: (Start)

%e For n = 47, the highest power of 2 less than n is 32, so a(47) = A001316(47-32) - 1 = A001316(15) - 1 = 16 - 1 = 15.

%e For n = 63, the highest power of 2 less than n is 32, so a(63) = A001316(63-32) - 1 = A001316(31) - 1 = 32 - 1 = 31. (End)

%t Table[2^DigitCount[# - 2^(Floor@ Log2@ # - Boole@ IntegerQ@ Log2@ #) - 1 + Boole[# == 1]/2, 2, 1] - 1 &[n + 1], {n, 0, 72}] (* _Michael De Vlieger_, Nov 18 2016 *)

%t a[ n_] := Which[ n < 3, 0, EvenQ[n], a @ Quotient[n, 2], True, a[ Quotient[n, 2]] 2 + 1]; (* _Michael Somos_, Dec 04 2016 *)

%o (PARI) a(n) = sum(m=1, n\2, bitxor(m,n-m)==n); \\ _Michel Marcus_, Dec 03 2016

%o (PARI) {a(n) = if( n<3, 0, n%2, a(n\2)*2 + 1, a(n\2))}; /* _Michael Somos_, Dec 04 2016 */

%Y Cf. A050315.

%K easy,nonn,base

%O 0,8

%A _Naohiro Nomoto_, Nov 14 2003