The number of binary bits necessary to represent a number, given explicitly by
where is the ceiling
function,
is the floor function, and
is lg, the logarithm
to base 2. For
,
1, 2, ..., the sequence of bit lengths is given by 0, 1, 2, 2, 3, 3, 3, 3, 4, 4,
4, 4, 4, 4, 4, 4, 5, 5, ... (OEIS A029837).
The function is given by the Wolfram Language
function BitLength[n].
Explore with Wolfram|Alpha
References
Sloane, N. J. A. Sequence A029837 in "The On-Line Encyclopedia of Integer Sequences."
Referenced on Wolfram|Alpha
Cite this as:
Weisstein, Eric W. "Bit Length." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/BitLength.html