TOPICS
Search

Bit Length


BitLength

The number of binary bits necessary to represent a number, given explicitly by

BL(n)=1+|_lgn_|
(1)
=[lg(n+1)],
(2)

where [x] is the ceiling function, |_x_| is the floor function, and lgn is lg, the logarithm to base 2. For n=0, 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."

Cite this as:

Weisstein, Eric W. "Bit Length." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/BitLength.html

Subject classifications