This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A384956 #37 Jun 17 2025 11:50:52 %S A384956 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, %T A384956 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, %U A384956 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 %N 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. %C A384956 n=0 is taken to be a single 0 bit, and all other n are taken without leading 0 bits. %C A384956 When the length of the binary representation of n is 2^k-1, then a(n) is 2^k-1. %H A384956 Karl-Heinz Hofmann, <a href="/A384956/a384956.png">Log scatter plot up to 2^22</a> %F A384956 a(n) = A000120(n) XOR A023416(n). %e A384956 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. %t A384956 a[n_] := BitXor @@ DigitCount[n, 2]; Array[a, 100, 0] (* _Amiram Eldar_, Jun 13 2025 *) %o A384956 (Python) %o A384956 def A384956(n): %o A384956 if n == 0 : return 1 %o A384956 return (n.bit_length() - (Ham:=n.bit_count())) ^ Ham # _Karl-Heinz Hofmann_, Jun 14 2025 %Y A384956 Cf. A000120, A023416, A070939, A328568. %Y A384956 Cf. A003987 (XOR). %K A384956 base,easy,look,nonn %O A384956 0,4 %A A384956 _Frederik P.J. Vandecasteele_, Jun 13 2025