Given an integer that is a power of 10, find the number of non-zero bits, k, in its binary representation.
For example:
The solution should work for arbitrarily large powers n, say at least till n = 100.
I can't get the last three cases to work out. I've checked the answers a couple of different ways. I still get 26 1s in the binary for 10^100. Is there a defect in the solutions offered?
The test cases are correct. In case you are using dec2bin, it is subject to loss of significance.
522 Solvers
Find the peak 3n+1 sequence value
790 Solvers
How to find the position of an element in a vector without using the find function
2320 Solvers
61 Solvers
Find the maximum number of decimal places in a set of numbers
156 Solvers