Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Problem 1226. Non-zero bits in 10^n.

Created by SK

Given an integer that is a power of 10, find the number of non-zero bits, k, in its binary representation.

For example:

  • n = 1, 10^n = 1010, so k = 2.
  • n = 5, 10^n = 11000011010100000, so k = 6.

The solution should work for arbitrarily large powers n, say at least till n = 100.


Problem Group

Solution Statistics

31 correct solutions 61 incorrect solutions
Last solution submitted on Sep 06, 2015

Problem Comments