Power of two
A power of two is a number of the form where is an integer, that is, the result of exponentiation with number two as the base and integer as the exponent. In the fast-growing hierarchy, is exactly equal to. In the Hardy hierarchy, is exactly equal to.
Powers of two with non-negative exponents are integers:,, and is two multiplied by itself times. The first ten powers of 2 for non-negative values of are:
By comparison, powers of two with negative exponents are fractions: for positive integer, is one half multiplied by itself times. Thus the first few negative powers of 2 are,,,, etc. Sometimes these are called inverse powers of two because each is the multiplicative inverse of a positive power of two.
Base of the binary numeral system
Because two is the base of the binary numeral system, powers of two are common in computer science. Written in binary, a power of two always has the form 100...000 or 0.00...001, just like a power of 10 in the decimal system.Computer science
Two to the power of, written as, is the number of values in which the bits in a binary word of length can be set, where each bit is either of two values. A word, interpreted as representing an integer in a range starting at zero, referred to as an "unsigned integer", can represent values from 0 to inclusively. An alternative representation, referred to as a signed integer, allows values that can be positive, negative and zero; see Signed number representations. Either way, one less than a power of two is often the upper bound of an integer in binary computers. As a consequence, numbers of this form show up frequently in computer software. As an example, a video game running on an 8-bit system might limit the score or the number of items the player can hold to 255—the result of using a byte, which is 8 bits long, to store the number, allowing the representation of 256 distinct values from to. For example, in the original Legend of Zelda the main character was limited to carrying 255 rupees at any given time, and the video game Pac-Man famously has a kill screen at level 256.Powers of two are often used to define units in which to quantify computer memory sizes. A "byte" now typically refers to eight bits, resulting in the possibility of 256 values. The prefix kilo, in conjunction with byte, has been used by computer scientists to mean . However, in general, the term kilo has been used in the International System of Units to mean . A series of binary prefixes has been standardized, including kibi meaning. Nearly all processor registers have sizes that are a power of two bits, 8, 16, 32 or 64 bits being very common, with the last two being most common except for very small processors.
Powers of two occur in a range of other places as well. For many disk drives, at least one of the sector size, number of sectors per track, and number of tracks per surface is a power of two. The logical block size is almost always a power of two.
Numbers that are closely related to powers of two occur in a number of computer hardware designs, such as with the number of pixels in the width and height of video screens, where the number of pixels in each direction is often the product of a power of two and a small number. For example,, and.
Mersenne and Fermat primes
A prime number that is one less than a power of two is called a Mersenne prime. For example, the prime number 31 is a Mersenne prime because it is 1 less than 32. Similarly, a prime number that is one more than a positive power of two is called a Fermat prime—the exponent itself is a power of two. A fraction that has a power of two as its denominator is called a dyadic rational. The numbers that can be represented as sums of consecutive positive integers are called polite numbers; they are exactly the numbers that are not powers of two.Euclid's ''Elements'', Book IX
The geometric progression 1, 2, 4, 8, 16, 32,... is important in number theory. Book IX, Proposition 36 of Elements proves that if the sum of the first terms of this progression is a prime number, then this sum times the th term is a perfect number. For example, the sum of the first 5 terms of the series, which is a prime number. The sum 31 multiplied by 16 equals 496, which is a perfect number.Book IX, Proposition 35, proves that in a geometric series if the first term is subtracted from the second and last term in the sequence, then as the excess of the second is to the first—so is the excess of the last to all those before it. Applying this to the geometric progression 31, 62, 124, 248, 496, we see that 62 minus 31 is to 31 as 496 minus 31 is to the sum of 31, 62, 124, 248. Therefore, the numbers 1, 2, 4, 8, 16, 31, 62, 124 and 248 add up to 496 and further these are all the numbers that divide 496. For suppose that divides 496 and it is not amongst these numbers. Assume is equal to, or 31 is to as is to 16. Now cannot divide 16 or it would be amongst the numbers 1, 2, 4, 8 or 16.
Therefore, 31 cannot divide. And since 31 does not divide and measures 496, the fundamental theorem of arithmetic implies that must divide 16 and be among the numbers 1, 2, 4, 8 or 16. Let be 4, then must be 124, which is impossible since by hypothesis is not amongst the numbers 1, 2, 4, 8, 16, 31, 62, 124 or 248.
First 64 powers of two
| 0 | 1 | | 16 | 65536 | | 32 | 4294967296 | | 48 | ||||
| 1 | 2 | | 17 | 33 | 49 | ||||||
| 2 | 4 | | 18 | 34 | 50 | ||||||
| 3 | 8 | | 19 | 35 | 51 | ||||||
| 4 | 16 | | 20 | 36 | 52 | ||||||
| 5 | 32 | | 21 | 37 | 53 | ||||||
| 6 | 64 | | 22 | 38 | 54 | ||||||
| 7 | 128 | | 23 | 39 | 55 | ||||||
| 8 | 256 | | 24 | 40 | 56 | ||||||
| 9 | 512 | | 25 | 41 | 57 | ||||||
| 10 | 1024 | | 26 | 42 | 58 | ||||||
| 11 | 2048 | | 27 | 43 | 59 | ||||||
| 12 | 4096 | | 28 | 44 | 60 | ||||||
| 13 | 8192 | | 29 | 45 | 61 | ||||||
| 14 | 16384 | | 30 | 46 | 62 | ||||||
| 15 | 32768 | | 31 | 47 | 63 |
Last digits
Starting with 2 the last digit is periodic with period 4, with the cycle 2–4–8–6–, and starting with 4 the last two digits are periodic with period 20. These patterns are generally true of any power, with respect to any base. The pattern continues where each pattern has starting point, and the period is the multiplicative order of 2 modulo , which is .Powers of 1024
The first few powers of 210 are slightly larger than those same powers of . The first 11 powers of 210 values are listed below:| 20 | = | 1 | = 10000 | |
| 210 | = | ≈ 10001 | ||
| 220 | = | ≈ 10002 | ||
| 230 | = | ≈ 10003 | ||
| 240 | = | ≈ 10004 | ||
| 250 | = | ≈ 10005 | ||
| 260 | = | ≈ 10006 | ||
| 270 | = | ≈ 10007 | ||
| 280 | = | ≈ 10008 | ||
| 290 | = | ≈ 10009 | ||
| 2100 | = | ≈ 100010 |
It takes approximately 17 powers of 1024 to reach 50% deviation and approximately 29 powers of 1024 to reach 100% deviation of the same powers of 1000. Also see Binary prefixes and IEEE 1541-2002.
Powers of two whose exponents are powers of two
Because data and the addresses of data are stored using the same hardware, and the data is stored in one or more octets, double exponentials of two are common in computing. The first 21 of them are:| digits | |||
| 0 | 1 | 2 | 1 |
| 1 | 2 | 4 | 1 |
| 2 | 4 | 16 | 2 |
| 3 | 8 | 256 | 3 |
| 4 | 16 | 65536 | | 5 |
| 5 | 32 | ||
| 6 | 64 | ||
| 7 | 128 | ||
| 8 | 256 | ||
| 9 | |||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 |
Also see Fermat number, Tetration and .