Including a value where x<=15 and the formula is true (like the x=8; n=2 example in your problem description) will make this solution wrong.
Number of 1s in the Binary Representation of a Number
356 Solvers
242 Solvers
484 Solvers
372 Solvers
139 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!