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 a context where only integers are considered, is restricted to non-negative values, so we have 1, 2, and 2 multiplied by itself a certain number of times.
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 ten in the decimal system.

Computer science

Two to the power of, written as, is the number of ways the bits in a binary word of length can be arranged. A word, interpreted as an unsigned integer, can represent values from 0 to 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. 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 measure computer memory. A byte is now considered eight bits. The prefix kilo, in conjunction with byte, may be, and has traditionally been, used, to mean 1,024. However, in general, the term kilo has been used in the International System of Units to mean 1,000. Binary prefixes have been standardized, such as kibi 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,, and. Put another way, they have fairly regular bit patterns.

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 1 + 2 + 4 + 8 + 16 = 31, 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 amongst 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.

Table of values

011665,536324,294,967,29648281,474,976,710,656
1217131,072338,589,934,59249562,949,953,421,312
2418262,1443417,179,869,184501,125,899,906,842,624
3819524,2883534,359,738,368512,251,799,813,685,248
416201,048,5763668,719,476,736524,503,599,627,370,496
532212,097,15237137,438,953,472539,007,199,254,740,992
664224,194,30438274,877,906,9445418,014,398,509,481,984
7128238,388,60839549,755,813,8885536,028,797,018,963,968
82562416,777,216401,099,511,627,7765672,057,594,037,927,936
95122533,554,432412,199,023,255,55257144,115,188,075,855,872
101,0242667,108,864424,398,046,511,10458288,230,376,151,711,744
112,04827134,217,728438,796,093,022,20859576,460,752,303,423,488
124,09628268,435,4564417,592,186,044,416601,152,921,504,606,846,976
138,19229536,870,9124535,184,372,088,832612,305,843,009,213,693,952
1416,384301,073,741,8244670,368,744,177,664624,611,686,018,427,387,904
1532,768312,147,483,64847140,737,488,355,328639,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, 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 1000:

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. For example,
012
124
2416
38256
41665,536
5324,294,967,296
664
7128
8256
9512
101,024
112,048
124,096
138,192
1416,384
1532,768
1665,536
17131,072
18262,144

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 distinct values, which can either be regarded as mere bit-patterns, or are more commonly interpreted as the unsigned numbers from 0 to, or as the range of signed numbers between and. 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.

Selected powers of two

; 28 = 256
; 210 = 1,024
; 212 = 4,096
; 215 = 32,768
; 216 = 65,536
; 220 = 1,048,576
; 224 = 16,777,216
; 229 = 536,870,912
; 230 = 1,073,741,824
; 231 = 2,147,483,648
; 232 = 4,294,967,296
; 240 = 1,099,511,627,776
; 250 = 1,125,899,906,842,624
; 253 = 9,007,199,254,740,992
; 256 = 72,057,594,037,927,936
; 260 = 1,152,921,504,606,846,976
; 263 = 9,223,372,036,854,775,808
; 264 = 18,446,744,073,709,551,616
; 268 = 295,147,905,179,352,825,856
; 270 = 1,180,591,620,717,411,303,424
; 280 = 1,208,925,819,614,629,174,706,176
; 286 = 77,371,252,455,336,267,181,195,264
; 296 = 79,228,162,514,264,337,593,543,950,336
; 2128 = 340,282,366,920,938,463,463,374,607,431,768,211,456
; 2168 = 374,144,419,156,711,147,060,143,317,175,368,453,031,918,731,001,856
; 2192 = 6,277,101,735,386,680,763,835,789,423,207,666,416,102,355,444,464,034,512,896
; 2256 =
115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,
639,936
; 2333 =
17,498,005,798,264,095,394,980,017,816,940,970,922,825,355,447,145,699,491,406,164,851,279,623,9
93,595,007,385,788,105,416,184,430,592
; 21024 = 179,769,313,486,231,590,772,931,...,304,835,356,329,624,224,137,216
; 282,589,933 = 148,894,445,742,041,...,210,325,217,902,592

Other properties

The sum of all -choose binomial coefficients is equal to. Consider the set of all -digit binary integers. Its cardinality is. It is also the sums of the cardinalities of certain subsets: the subset of integers with no 1s, the subset with a single 1, the subset with two 1s, and so on up to the subset with 1s. Each of these is in turn equal to the binomial coefficient indexed by and the number of 1s being considered.
Currently, powers of two are the only known almost perfect numbers.
The number of vertices of an -dimensional hypercube is. Similarly, the number of -faces of an -dimensional cross-polytope is also and the formula for the number of -faces an -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 is 1/3.
The smallest natural power of two whose decimal representation begins with 7 is
Every power of 2 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 least number of ways.