A384956 Binary XOR of number of 1-bits in the binary representation of n and number of 0-bits in the binary representation of n, a(0) = 1.
1, 1, 0, 2, 3, 3, 3, 3, 2, 0, 0, 2, 0, 2, 2, 4, 5, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 5, 1, 5, 5, 5, 4, 6, 6, 0, 6, 0, 0, 6, 6, 0, 0, 6, 0, 6, 6, 4, 6, 0, 0, 6, 0, 6, 6, 4, 0, 6, 6, 4, 6, 4, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
Offset: 0
Examples
179 (10110011_2) has 5 (101_2) 1-bits and 3 (011_2) 0-bits. 101_2 XOR 011_2 = 110_2 = 6. a(179) = 6.
Links
- Karl-Heinz Hofmann, Log scatter plot up to 2^22
Programs
-
Mathematica
a[n_] := BitXor @@ DigitCount[n, 2]; Array[a, 100, 0] (* Amiram Eldar, Jun 13 2025 *)
-
Python
def A384956(n): if n == 0 : return 1 return (n.bit_length() - (Ham:=n.bit_count())) ^ Ham # Karl-Heinz Hofmann, Jun 14 2025
Comments