Davoud Nosrati · a presentation

How many bits?

The digits a number needs, in any base

The obvious answer is ⌈log2 N⌉, and it's right almost every time. It goes wrong on exactly the powers of two. This presentation, animated with Manim, finds out why and builds the formula that always works.

8421 1101 1000 13 8 = = ⌈log2 13⌉ = 4 ⌈log2 8⌉ = 3 one short
Both numbers take four bits; the guess only gets one of them right. The fix turns out to be ⌈log2(N + 1)⌉.

In the slides, ← → or a swipe moves between steps, and F goes full screen.