How many bits are required to represent a given number N in binary notation ? Can you come up with a formula for the same. For example F(N) for N = 7 is 3, since 111 is the binary representation for 7. F(N) for N=8 is 4.
Spoiler: F(N) = lg (N) + 1
How does the formula change when representing N in decimal notation.
Subscribe to:
Post Comments (Atom)
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletefloor(lg N) + 1.
ReplyDelete