Powers of 2

 

It is important for a Computer Scientist to know the powers of 2.  You need to know how much data can fit in a given number of bits.  Below are some values that you may frequently encounter.

 

n

2n

 

0

1

 

1

2

 

2

4

 

3

8

 

4

16

 

5

32

 

6

64

 

7

128

 

8

256

 

9

512

 

10

1024

1 K

11

2048

2 K

12

4096

4 K

20

1048576

1 M

30

1073741824

1 G

 

Notice that 210 is approximately 103.  If you want to determine the approximate largest value that will fit in a large number of bits you can use the following algorithm.

 

B = number of bits

T = B / 10                     integer division  (first decimal digits)

R = B mod 10              remainder of above division (last decimal digit)

Using the above table get M = 2R

Decimal value is M * 103*T

 

For example: DES keys are 56 bits in length.  How many possible key values are there?

 

T = 5 R = 6 M = 64

There are approximately 64 * 1015 possible key combinations.