login
Number of ones in binary representation of odious numbers.
5

%I #11 Jul 22 2023 16:36:36

%S 1,1,1,3,1,3,3,3,1,3,3,3,3,3,3,5,1,3,3,3,3,3,3,5,3,3,3,5,3,5,5,5,1,3,

%T 3,3,3,3,3,5,3,3,3,5,3,5,5,5,3,3,3,5,3,5,5,5,3,5,5,5,5,5,5,7,1,3,3,3,

%U 3,3,3,5,3,3,3,5,3,5,5,5,3,3,3,5,3,5,5,5,3,5,5,5,5,5,5,7,3,3,3,5,3,5,5,5,3

%N Number of ones in binary representation of odious numbers.

%H Reinhard Zumkeller, <a href="/A132680/b132680.txt">Table of n, a(n) for n = 1..10001</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/OdiousNumber.html">Odious Number</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Thue-MorseSequence.html">Thue-Morse Sequence</a>.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>.

%F a(n) = a(floor(n/2)) + 2*(n mod 2)*(1-A010060(n)).

%F a(n) = A000120(A000069(n)).

%F a(A129771(n)) = a((A129771(n)-1)/2) + 2.

%F a(A083420(n)) = A005408(n).

%t Select[DigitCount[Range[200], 2, 1], OddQ] (* _Amiram Eldar_, Jul 22 2023 *)

%o (PARI) a(n)=hammingweight(2*n-1-hammingweight(n-1)%2) \\ _Charles R Greathouse IV_, Mar 26 2013

%Y Cf. A000069, A000120, A010060, A005408, A083420, A129771.

%K nonn,easy

%O 1,4

%A _Reinhard Zumkeller_, Aug 26 2007