Powers of two with non-negative exponents are integers: 20 = 1, 21 = 2, and 2n is two multiplied by itself n times.
[1][2] The first ten powers of 2 for non-negative values of n are: By comparison, powers of two with negative exponents are fractions: for positive integer n, 2−n is one half multiplied by itself n times.
Because two is the base of the binary numeral system, powers of two are common in computer science.
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 0 to 28 − 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 define units in which to quantify computer memory sizes.
A "byte" now typically refers to eight bits (an octet), resulting in the possibility of 256 values (28).
(The term byte once meant (and in some cases, still means) a collection of bits that was defined by the hardware context, typically of 5 to 32 bits, rather than only an 8-bit unit.)
The prefix kilo, in conjunction with byte, has been used by computer scientists to mean 1024 (210).
However, in general, the term kilo has been used in the International System of Units to mean 1000 (103).
Binary prefixes have been standardized, such as kibi (Ki) meaning 1024.
[citation needed] The logical block size is almost always a power of two.
A fraction that has a power of two as its denominator is called a dyadic rational.
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.
The sum 31 multiplied by 16 (the 5th term in the series) equals 496, which is a perfect number.
These patterns are generally true of any power, with respect to any base.
The pattern continues where each pattern has starting point 2k, and the period is the multiplicative order of 2 modulo 5k, which is φ(5k) = 4 × 5k−1 (see Multiplicative group of integers modulo n).
These patterns are generally true of any power, with respect to any base.
The pattern continues where each pattern has starting point 2k, and the period is the multiplicative order of 2 modulo 5k, which is φ(5k) = 4 × 5k−1 (see Multiplicative group of integers modulo n).
[citation needed] In a connection with nimbers, these numbers are often called Fermat 2-powers.
of positive integers, the series converges to an irrational number.
[4] Since it is common for computer data types to have a size which is a power of two, these numbers count the number of representable values of that type.
For example, a 32-bit word consisting of 4 bytes can represent 232 distinct values, which can either be regarded as mere bit-patterns, or are more commonly interpreted as the unsigned numbers from 0 to 232 − 1, or as the range of signed numbers between −231 and 231 − 1.
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.
, closely relates the interval of 7 semitones in equal temperament to a perfect fifth of just intonation:
The smallest natural power of two whose decimal representation begins with 7 is[11] Every power of 2 (excluding 1) can be written as the sum of four square numbers in 24 ways.
Huffman codes deliver optimal lossless data compression when probabilities of the source symbols are all negative powers of two.