186k views
3 votes
I need to represent 2 million different numbers in binary. How many bits will I need to represent them in binary?

1 Answer

4 votes

Answer:

21 bits

Step-by-step explanation:

The formula that will be used is given as

2^No. of bits = No. of combinations

There we need to find

No. of Bits?

Given is

No of Combinations = 2 million = 20,000,00

so,

2^ No. of bits = 20,000,00

so

No.of bits = Log 2 (20,000,00) = log 10 (20,000,00)/log 10 (2)

= 20.93 which is approximately = 21

So, 21 bits required for 2 million numbers.

It means that, if we have 21 number of bits, we can make 2 million combinations.

for example

If we have 2 bits

we can make

2^2 combinations which is equal to 4.

So four combinations with 2 bits are given below:

0 00

1 01

2 10

3 11

User Zgwortz
by
6.3k points