The bit length
of a positive integer
is the number of binary digits
in its representation without leading zeros. It is given by
|
(1)
| |||
|
(2)
|
where is the ceiling
function,
is the floor function, and
denotes the binary logarithm
(see lg). Adopt
by convention. 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, with
). The function is given by the Wolfram
Language function BitLength[n].