The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A071295 Product of numbers of 0's and 1's in binary representation of n. 6

%I #23 Aug 25 2020 12:32:37

%S 0,0,1,0,2,2,2,0,3,4,4,3,4,3,3,0,4,6,6,6,6,6,6,4,6,6,6,4,6,4,4,0,5,8,

%T 8,9,8,9,9,8,8,9,9,8,9,8,8,5,8,9,9,8,9,8,8,5,9,8,8,5,8,5,5,0,6,10,10,

%U 12,10,12,12,12,10,12,12,12,12,12,12,10,10,12,12,12,12,12,12,10,12,12,12

%N Product of numbers of 0's and 1's in binary representation of n.

%C a(n) = A023416(n)*A000120(n);

%C a(1)=0, a(2*n)=(A023416(n)+1)*A000120(n), a(2*n+1)=(A000120(n)+1)*A023416(n);

%C a(n) = 0 iff n=2^k-1 for some k.

%C a(A059011(n)) mod 2 = 1. - _Reinhard Zumkeller_, Aug 09 2014

%H T. D. Noe, <a href="/A071295/b071295.txt">Table of n, a(n) for n = 0..1023</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)) + (1 - n mod 2) * A000120(floor(n/2)) + (n mod 2)*A023416(floor(n/2)).

%e a(14)=3 because 14 is 1110 in binary and has 3 ones and 1 zero.

%t f[n_] := Block[{s = IntegerDigits[n, 2]}, Count[s, 0] Count[s, 1]]; Table[ f[n], {n, 0, 90}]

%t Table[DigitCount[n,2,1]DigitCount[n,2,0],{n,0,100}] (* _Harvey P. Dale_, Sep 19 2019 *)

%o (Haskell)

%o a071295 n = a000120 n * a023416 n -- _Reinhard Zumkeller_, Aug 09 2014

%o (Python)

%o def A071295(n):

%o return bin(n)[1:].count('0')*bin(n).count('1') # _Chai Wah Wu_, Dec 23 2019

%Y Cf. A007088.

%Y Cf. A000120, A023416, A059011.

%K nonn,nice,base

%O 0,5

%A _Reinhard Zumkeller_, Jun 20 2002

%E Edited by _N. J. A. Sloane_ and _Robert G. Wilson v_, Oct 11 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 7 11:48 EDT 2024. Contains 373173 sequences. (Running on oeis4.)