Possible solution
Here's a possible solution:
Write out the number in binary with no leading zeroes. The result is 2*n1+n0, where n1 is the number of 1s in the binary representation, and n0 is the number of zeroes.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.