I'm taking a Computer Algorithms class and one of my problems is from Skiena's Algorithm Design Manual, 2-41:
Prove that the binary representation of $n \ge 1$ has $\lfloor \lg n \rfloor +1$ bits ($\lg$ is base 2)
Some base cases:
$n = 1, \lfloor \lg 1 \rfloor + 1 = 1$
$n = 2, \lfloor \lg 2 \rfloor + 1 = 2$
$n = 5, \lfloor \lg 5 \rfloor + 1 = 3$
$n = 15, \lfloor \lg 15 \rfloor + 1 = 4$
I don't know where to go from there though. Any help appreciated.
Hint: For which numbers $n$ is $\lg n$ an integer?