We have seen in this page that the powers of two can be used to represent large numbers with sets of bits. One way to do it is by associating the powers of two with the positions of the bits in the set. In this page, we will see how the powers of two work in general.

The power is a mathematical operation which consists in multiplying a number by itself several times, it is represented with an exponent. For example, the power of 3 of a number that we will call **n** is expressed as **n ^{3}** and it is equivalent to multiplying

**n**three times by itself:

** n ^{3} = n × n × n**

In the case of powers of two, the power **p** therefore corresponds to multiplying the number **2** **p** times by itself. So for example **2 ^{3}** corresponds to

**2 × 2 × 2 = 8**. Each successive power therefore doubles the value of the previous one because

**2**is equal to

^{p + 1}**2**.

^{p}× 2The following table contains the values of the powers of two between 0 to 16 (by convention 2^{0} is equal to 1) which are frequently used, you can find here a much larger table with the powers of two up to **2 ^{1024}**.

Power of 2 | Value |
---|---|

2^{0} |
1 |

2^{1} |
2 |

2^{2} |
4 |

2^{3} |
8 |

2^{4} |
16 |

2^{5} |
32 |

2^{6} |
64 |

2^{7} |
128 |

2^{8} |
256 |

2^{9} |
512 |

2^{10} |
1024 |

2^{11} |
2048 |

2^{12} |
4096 |

2^{13} |
8192 |

2^{14} |
16384 |

2^{15} |
32768 |

2^{16} |
65536 |

The power p of 2, that is 2^{p}, is also used to know how many different integer numbers can be represented by a set of p bits. Thus 8 bits are used to represent 2^{8} = 256 different integer numbers, from 0 to 255 for example.