Monday, August 3, 2009

Binary is all about 1 and 0

6 in binary form can be written as 110. Number of 1's in 110 are 2. Let fun(n) be such a function which returns the number of 1's in the binary representation of n. Let Sum(n) = fun(1) + fun(2) + .... + fun(n). Find sum(2147483647)

No comments: