A128975 a(n) = the number of unordered triples of integers (a,b,c) with a+b+c=n, whose bitwise XOR is zero. Equivalently, the number of three-heap nim games with n stones which are in a losing position for the first player.
0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 4, 0, 0, 0, 1, 0, 1, 0, 4, 0, 1, 0, 4, 0, 4, 0, 13, 0, 0, 0, 1, 0, 1, 0, 4, 0, 1, 0, 4, 0, 4, 0, 13, 0, 1, 0, 4, 0, 4, 0, 13, 0, 4, 0, 13, 0, 13, 0, 40, 0, 0, 0, 1, 0, 1, 0, 4, 0, 1, 0, 4, 0, 4, 0, 13, 0, 1, 0, 4, 0, 4, 0, 13, 0, 4, 0, 13, 0, 13, 0, 40, 0, 1, 0, 4, 0, 4, 0
Offset: 1
Examples
For example, a(14)=4; the four 3-tuples are (1,6,7), (2,5,7), (3,4,7) and (3,5,6).
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
- Tanya Khovanova, There are no coincidences, arXiv preprint 1410.2193 [math.CO], 2014.
Programs
-
PARI
A128975(n) = if(n%2,0,(1/2)*((3^(hammingweight(n)-1))-1)); \\ Antti Karttunen, Sep 25 2018
Formula
a(n)=0 if n is odd; otherwise, a(n) = ( 3^(r-1) - 1)/2, where r is the number of 1's in the binary expansion of n.
Comments