Skip navigation

The question is: How many bits do you need to represent the following numbers in a computer?

a) 3000

b) 3

c) 20

d) 598225

The answer to each is found by this formula:

numBits = ceil( log2( n ) )

If you are on a hand-calculator, you can always get log2 by doing:

numBits = log10n
log10(2)

Dividing by log102 gives you the right answer.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: