A power of two is a number of the form 2^{n} where n is an integer, that is, the result of exponentiation with number two as the base and integer n as the exponent.
In a context where only integers are considered, n is restricted to non-negative values,^{[1]} so there are 1, 2, and 2 multiplied by itself a certain number of times.^{[2]}
The first ten powers of 2 for non-negative values of n are:
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.
Two to the exponent of n, written as 2^{n}, is the number of ways the bits in a binary word of length n can be arranged. A word, interpreted as an unsigned integer, can represent values from 0 (000...000_{2}) to 2^{n} − 1 (111...111_{2}) inclusively. Corresponding signed integer values 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, giving a maximum value of 2^{8} − 1 = 255. For example, in the original Legend of Zelda the main character was limited to carrying 255 rupees (the currency of the game) 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 measure computer memory. A byte is now considered eight bits (an octet), resulting in the possibility of 256 values (2^{8}). (The term byte once meant (and in some cases, still means) a collection of bits, typically of 5 to 32 bits, rather than only an 8-bit unit.) The prefix kilo, in conjunction with byte, may be, and has traditionally been, used, to mean 1,024 (2^{10}). However, in general, the term kilo has been used in the International System of Units to mean 1,000 (10^{3}). Binary prefixes have been standardized, such as kibi (Ki) meaning 1,024. Nearly all processor registers have sizes that are powers of two, 32 or 64 being very common.
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 not powers of two occur in a number of situations, such as video resolutions, but they are often the sum or product of only two or three powers of two, or powers of two minus one. For example, 640 = 32 × 20, and 480 = 32 × 15. Put another way, they have fairly regular bit patterns.
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 (2^{5}). Similarly, a prime number (like 257) 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.
The geometric progression 1, 2, 4, 8, 16, 32, ... (or, in the binary numeral system, 1, 10, 100, 1000, 10000, 100000, ... ) is important in number theory. Book IX, Proposition 36 of Elements proves that if the sum of the first n terms of this progression is a prime number (and thus is a Mersenne prime as mentioned above), then this sum times the nth term is a perfect number. For example, the sum of the first 5 terms of the series 1 + 2 + 4 + 8 + 16 = 31, which is a prime number. The sum 31 multiplied by 16 (the 5th term in the series) 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. (This is a restatement of our formula for geometric series from above.) Applying this to the geometric progression 31, 62, 124, 248, 496 (which results from 1, 2, 4, 8, 16 by multiplying all terms by 31), 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 p divides 496 and it is not amongst these numbers. Assume p q is equal to 16 × 31, or 31 is to q as p is to 16. Now p cannot divide 16 or it would be amongst the numbers 1, 2, 4, 8 or 16. Therefore, 31 cannot divide q. And since 31 does not divide q and q measures 496, the fundamental theorem of arithmetic implies that q must divide 16 and be amongst the numbers 1, 2, 4, 8 or 16. Let q be 4, then p must be 124, which is impossible since by hypothesis p is not amongst the numbers 1, 2, 4, 8, 16, 31, 62, 124 or 248.
(sequence A000079 in the OEIS)
n | 2^{n} | n | 2^{n} | n | 2^{n} | n | 2^{n} | |||
---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 16 | 65,536 | 32 | 4,294,967,296 | 48 | 281,474,976,710,656 | |||
1 | 2 | 17 | 131,072 | 33 | 8,589,934,592 | 49 | 562,949,953,421,312 | |||
2 | 4 | 18 | 262,144 | 34 | 17,179,869,184 | 50 | 1,125,899,906,842,624 | |||
3 | 8 | 19 | 524,288 | 35 | 34,359,738,368 | 51 | 2,251,799,813,685,248 | |||
4 | 16 | 20 | 1,048,576 | 36 | 68,719,476,736 | 52 | 4,503,599,627,370,496 | |||
5 | 32 | 21 | 2,097,152 | 37 | 137,438,953,472 | 53 | 9,007,199,254,740,992 | |||
6 | 64 | 22 | 4,194,304 | 38 | 274,877,906,944 | 54 | 18,014,398,509,481,984 | |||
7 | 128 | 23 | 8,388,608 | 39 | 549,755,813,888 | 55 | 36,028,797,018,963,968 | |||
8 | 256 | 24 | 16,777,216 | 40 | 1,099,511,627,776 | 56 | 72,057,594,037,927,936 | |||
9 | 512 | 25 | 33,554,432 | 41 | 2,199,023,255,552 | 57 | 144,115,188,075,855,872 | |||
10 | 1,024 | 26 | 67,108,864 | 42 | 4,398,046,511,104 | 58 | 288,230,376,151,711,744 | |||
11 | 2,048 | 27 | 134,217,728 | 43 | 8,796,093,022,208 | 59 | 576,460,752,303,423,488 | |||
12 | 4,096 | 28 | 268,435,456 | 44 | 17,592,186,044,416 | 60 | 1,152,921,504,606,846,976 | |||
13 | 8,192 | 29 | 536,870,912 | 45 | 35,184,372,088,832 | 61 | 2,305,843,009,213,693,952 | |||
14 | 16,384 | 30 | 1,073,741,824 | 46 | 70,368,744,177,664 | 62 | 4,611,686,018,427,387,904 | |||
15 | 32,768 | 31 | 2,147,483,648 | 47 | 140,737,488,355,328 | 63 | 9,223,372,036,854,775,808 |
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 2^{k}, and the period is the multiplicative order of 2 modulo 5^{k}, which is φ(5^{k}) = 4 × 5^{k−1} (see Multiplicative group of integers modulo n).^{[citation needed]}
(sequence A140300 in the OEIS)
The first few powers of 2^{10} are slightly larger than those same powers of 1000 (10^{3}):
2^{0} | = | 1 | = 1000^{0} | (0% deviation) |
2^{10} | = | 1 024 | ≈ 1000^{1} | (2.4% deviation) |
2^{20} | = | 1 048 576 | ≈ 1000^{2} | (4.9% deviation) |
2^{30} | = | 1 073 741 824 | ≈ 1000^{3} | (7.4% deviation) |
2^{40} | = | 1 099 511 627 776 | ≈ 1000^{4} | (10.0% deviation) |
2^{50} | = | 1 125 899 906 842 624 | ≈ 1000^{5} | (12.6% deviation) |
2^{60} | = | 1 152 921 504 606 846 976 | ≈ 1000^{6} | (15.3% deviation) |
2^{70} | = | 1 180 591 620 717 411 303 424 | ≈ 1000^{7} | (18.1% deviation) |
2^{80} | = | 1 208 925 819 614 629 174 706 176 | ≈ 1000^{8} | (20.9% deviation) |
2^{90} | = | 1 237 940 039 285 380 274 899 124 224 | ≈ 1000^{9} | (23.8% deviation) |
2^{100} | = | 1 267 650 600 228 229 401 496 703 205 376 | ≈ 1000^{10} | (26.8% deviation) |
2^{110} | = | 1 298 074 214 633 706 907 132 624 082 305 024 | ≈ 1000^{11} | (29.8% deviation) |
2^{120} | = | 1 329 227 995 784 915 872 903 807 060 280 344 576 | ≈ 1000^{12} | (32.9% deviation) |
2^{130} | = | 1 361 129 467 683 753 853 853 498 429 727 072 845 824 | ≈ 1000^{13} | (36.1% deviation) |
2^{140} | = | 1 393 796 574 908 163 946 345 982 392 040 522 594 123 776 | ≈ 1000^{14} | (39.4% deviation) |
2^{150} | = | 1 427 247 692 705 959 881 058 285 969 449 495 136 382 746 624 | ≈ 1000^{15} | (42.7% deviation) |
See also: Binary prefixes and IEEE 1541-2002 |
Because data (specifically integers) and the addresses of data are stored using the same hardware, and the data is stored in one or more octets (2^{3}), double exponentials of two are common. For example,
n | 2^{n} | 2^{2n} (sequence A001146 in the OEIS) |
---|---|---|
0 | 1 | 2 |
1 | 2 | 4 |
2 | 4 | 16 |
3 | 8 | 256 |
4 | 16 | 65,536 |
5 | 32 | 4,294,967,296 |
6 | 64 | 18, |
7 | 128 | 340, |
8 | 256 | 115, |
9 | 512 | 13, |
10 | 1,024 | 179, |
11 | 2,048 | 32, |
12 | 4,096 | 1, |
13 | 8,192 | 1, |
14 | 16,384 | 1, |
15 | 32,768 | 1, |
16 | 65,536 | 2, |
17 | 131,072 | 4, |
18 | 262,144 | 16, |
Several of these numbers represent the number of values representable using common computer data types. For example, a 32-bit word consisting of 4 bytes can represent 2^{32} distinct values, which can either be regarded as mere bit-patterns, or are more commonly interpreted as the unsigned numbers from 0 to 2^{32} − 1, or as the range of signed numbers between −2^{31} and 2^{31} − 1. Also see tetration and lower hyperoperations. For more about representing signed numbers see two's complement.
In a connection with nimbers, these numbers are often called Fermat 2-powers.
The numbers form an irrationality sequence: for every sequence of positive integers, the series
converges to an irrational number. Despite the rapid growth of this sequence, it is the slowest-growing irrationality sequence known.^{[3]}
int
variable in the Java, C#, and SQL programming languages.Cardinal
or Integer
variable in the Pascal programming language.The sum of all n-choose binomial coefficients is equal to 2^{n}. Consider the set of all n-digit binary integers. Its cardinality is 2^{n}. It is also the sums of the cardinalities of certain subsets: the subset of integers with no 1s (consisting of a single number, written as n 0s), the subset with a single 1, the subset with two 1s, and so on up to the subset with n 1s (consisting of the number written as n 1s). Each of these is in turn equal to the binomial coefficient indexed by n and the number of 1s being considered (for example, there are 10-choose-3 binary numbers with ten digits that include exactly three 1s).
Currently, powers of two are the only known almost perfect numbers.
The number of vertices of an n-dimensional hypercube is 2^{n}. Similarly, the number of (n − 1)-faces of an n-dimensional cross-polytope is also 2^{n} and the formula for the number of x-faces an n-dimensional cross-polytope has is
The sum of the reciprocals of the powers of two is 1. The sum of the reciprocals of the squared powers of two (powers of four) is 1/3.
The smallest natural power of two whose decimal representation begins with 7 is^{[9]}
Every power of 2 (excluding 1) can be written as the sum of four square numbers in 24 ways. The powers of 2 are the natural numbers greater than 1 that can be written as the sum of four square numbers in the fewest ways.
As a real polynomial, a^{n} + b^{n} is irreducible, if and only if n is a power of two. (If n is odd, then a^{n} + b^{n} is divisible by a+n, and if n is even but not a power of 2, then n can be written as n=mp, where m is odd, and thus , which is divisible by a^{p} + b^{p}.) But in the domain of complex numbers, the polynomial (where n>=1) can always be factorized as , even if n is a power of two.
In musical notation, all unmodified note values have a duration equal to a whole note divided by a power of two; for example a half note (1/2), a quarter note (1/4), an eighth note (1/8) and a sixteenth note (1/16). Dotted or otherwise modified notes have other durations. In time signatures the lower numeral, the beat unit, which can be seen as the denominator of a fraction, is almost always a power of two.
If the ratio of frequencies of two pitches is a power of two, then the interval between those pitches is full octaves. In this case, the corresponding notes have the same name.