Math Fun

How many digits are in a number n bits expressed in base b?

digits = n / (n / logb(2 ^ n))

In case your calculator doesn’t have a logb(n) function on it (mine doesn’t), use the version below.

digits = n / (n / (log(2 ^ n) / log(b)))

I’ve needed to know that several times and never took the time to figure it out or find it, but today I did. Isn’t that handy?

Here’s a little JavaScript calculator you can use to try it out.

Bits:
Base:
Digits: