Every integer has an equivalent representation in decimal and binary. Except for 0 and 1, the binary representation of an integer has more digits than its decimal counterpart. To find the number of binary digits (bits) corresponding to any given decimal integer, you could convert the decimal number to binary and count the bits. For example, the two-digit decimal integer 29 converts to the five-digit binary integer 11101. But there’s a way to compute the number of bits directly, without the conversion.

Sometimes you want to know, not how many bits are required for a *specific* integer, but how many are required for a *d*-digit integer — a *range* of integers. A range of integers has a range of bit counts. For example, four-digit decimal integers require between 10 and 14 bits. For any *d*-digit range, you might want to know its minimum, maximum, or average number of bits. Those values can be computed directly as well.