In the last section, we established that every positive integer can be uniquely expressed as a sum of distinct powers of 2. In a sense, you could say that the powers of 2 are the building blocks of the positive integers under the operation of addition. In this section, we’ll see that the prime numbers play a similar role with regard to multiplication:
every positive integer can be uniquely expressed as a product of primes.
Yet unlike the powers of 2, which can be easily identified and hold few mathematical surprises, the prime numbers are much trickier, and there are still many things we don’t know about them.
A prime number is a positive integer with exactly two positive divi-sors, namely 1 and itself. Here are the first few primes.
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53. . .
The number 1 is not considered a prime number because it has only one divisor, namely 1. (There is a more significant reason why 1 is not considered prime, which we will mention shortly.) Notice that 2 is the
only even prime. Some might say that makes it the oddest of all prime numbers!
A positive integer with three or more divisors is called composite since it can be composed into smaller factors. The first few composites are
4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30. . . For example, the number 4 has exactly three divisors: 1, 2, and 4.
The number 6 has four divisors: 1, 2, 3, and 6. Note the number 1 is not composite either. Mathematicians call the number 1 a unit, and it has the property that it is a divisor of every integer.
Every composite number can be expressed as the product of primes.
Let’s factor 120 into primes. We might start by writing 120 = 6×20.
Now, 6 and 20 are composite, but they can be factored into primes, namely 6=2×3 and 20=2×2×5. Thus,
120=2×2×2×3×5=233151
Interestingly, no matter how we initially factor our number, we still wind up with the same prime factorization. This is a consequence of the unique factorization theorem, also known as the fundamental theo-rem of arithmetic, which states that every positive integer greater than 1 has a unique prime factorization.
By the way, the real reason the number 1 is not considered to be prime is that if it were, then this theorem would not be true. For exam-ple, the number 12 could be factored as 2×2×3, but it could also be factored as 1×1×2×2×3, so the factorization into primes would no longer be unique.
Once you know how a number factors, you know an awful lot about that number. When I was a kid, my favorite number was 9, but as I grew older, my favorite numbers became larger, then gradually more complex (for example, π = 3.14159 . . . ,φ = 1.618 . . . , e = 2.71828 . . . , and i, which has no decimal representation, but we will discuss that in Chapter 10). For a while, before I started experimenting with irra-tional numbers, my favorite number was 2520, since it was the smallest number that was divisible by all the numbers from 1 through 10. It has prime factorization
2520=23325171
Once you know a number’s prime factorization, you can instantly determine how many positive divisors it has. For example, any divisor of 2520 must be of the form 2a3b5c7dwhere a is 0, 1, 2, or 3 (4 choices), b is 0, 1, or 2 (3 choices), c is 0 or 1 (2 choices), and d is 0 or 1 (2 choices). Thus by the rule of product, 2520 has 4×3×2×2=48 positive divisors.
Aside
The proof of the fundamental theorem of arithmetic exploits the follow-ing fact about prime numbers (proved in the first chapter of any number theory textbook). If p is a prime number and p divides a product of two or more numbers, then p must be a divisor of at least one of the terms in the product. For example,
999,999=333× 3003
is a multiple of 11, so 11 must divide 333 or 3003. (In fact, 3003= 11× 273.) This property is not always true with composite numbers. For example, 60=6×10 is a multiple of 4, even though 4 does not divide 6 or 10.
To prove unique factorization, suppose the contrary, that some num-ber had more than one prime factorization. Suppose that N was the smallest number that had two different prime factorizations. Say
p1p2· · · pr =N =q1q2· · · qs
where all of the piand qjterms are prime. Since N is certainly a multiple of the prime p1, then p1must be a divisor of one of the qj terms. Let’s say, for ease of notation, that p1divides q1. Thus, since q1is prime, we must have q1 = p1. So if we divide the entire equation above by p1, we get
p2· · · pr= pN
1 =q2· · · qs
But now the number pN
1 has two different prime factorizations, which contradicts our assumption that N was the smallest such number.
Aside
Incidentally, there are number systems where not everything factors in a unique way. For example, on Mars, where all Martians have two heads, they only use even numbers
2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, . . .
In this Martian number system, a number like 6 or 10 is considered prime because it cannot be factored into smaller even numbers. In this system, the primes and composite numbers simply alternate. Every multiple of 4 is composite (since 4k =2×2k) and all the other even numbers (like 6, 10, 14, 18, and so on), are prime, since they can’t be factored into two smaller even numbers. But now consider the number 180:
6× 30=180=10× 18
Under the Martian number system, the number 180 can be factored into primes in two different ways, so prime factorization is not unique in the number system used on this planet.
Very…
…interesting!
Among the numbers from 1 to 100, there are exactly 25 primes.
Among the next hundred numbers, there are 21 primes, then 16 primes among the hundred numbers after that. As we look at larger and larger numbers, primes tend to become rarer (but not in a predictable way—
for example there are still 16 primes between 300 and 400 and 17 primes between 400 and 500). The number of primes between 1,000,000 and 1,000,100 is only 6. The fact that primes become more scarce makes sense because a large number has so many numbers below it that could potentially divide it.
We can prove that there are stretches of 100 numbers with no primes.
There are even primeless collections of consecutive numbers of length 1000, or 1 million, or as long as you’d like. Let me try to convince you of this fact by instantly providing you with 99 consecutive composite numbers (although this isn’t the first time that this happens). Consider the 99 consecutive numbers
100!+2, 100!+3, 100!+4,. . ., 100!+100
Since 100!=100×99×98× · · · ×3×2×1, it must be divisible by all the numbers from 2 to 100. Now consider a number like 100!+53.
Since 53 divides into 100!, then it must also divide into 100!+53. The same argument shows that for all 2 ≤ k ≤ 100, 100!+k must be a multiple of k, so it must be composite.
Aside
Note that our argument doesn’t say anything about the primeness of 100!+1, but we can determine that as well. There is a beautiful theorem called Wilson’s theorem, which says that n is a prime number if and only if(n−1)!+1 is a multiple of n. Try it on a few small numbers to see it in action: 1!+1 = 2 is a multiple of 2; 2!+1 = 3 is a multiple of 3;
3!+1 = 7 is not a multiple of 4; 4!+1= 25 is a multiple of 5; 5!+1 = 121 is not a multiple of 6; 6!+1 = 721 is a multiple of 7; and so on.
Consequently, since 101 is prime, Wilson’s theorem says that 100!+1 is a multiple of 101, and is therefore composite. Thus the numbers 100!
through 100!+100 comprise 101 consecutive composite numbers.
With prime numbers becoming scarcer and scarcer among the very large numbers, it is natural to wonder if at some point we simply run out of primes. As Euclid told us over two thousand years ago, this will not be the case. But don’t just take his word for it; enjoy the proof for yourself.
Theorem: There are infinitely many primes.
Proof: Suppose, to the contrary, that there were only finitely many primes. Hence there must be some largest prime number, which we shall denote by P. Now consider the number P!+1. Since P! is divisible by all numbers between 2 and P, none of those numbers can divide P!+1.
Thus P!+1 must have a prime factor that is larger than P, contradicting the assumption that P was the largest prime.
Although we will never find a largest prime number, that doesn’t stop mathematicians and computer scientists from searching for larger and larger primes. As of this writing, the largest known prime has 17,425,170 digits. Just to write that number down would require nearly a hundred books of this size. Yet we can describe that number on one line:
257,885,161−1
The reason it has that simple form is that there are especially efficient methods for determining whether or not numbers of the form 2n−1 or 2n+1 are prime.
Aside
The great mathematician Pierre de Fermat proved that if p is an odd prime number, then the number 2p−1−1 must be a multiple of p. Check this out with the first few odd primes. For the primes 3, 5, 7, 11, we see 22−1=3 is a multiple of 3; 24−1=15 is a multiple of 5; 26−1=63 is a multiple of 7; and 210−1 =1023 is a multiple of 11. As for composite numbers, it is clear that if n is even, then 2n−1−1 must be odd, so it can’t be a multiple of n. Checking the first few odd composites 9, 15, and 21, we see that 28−1=255 is not a multiple of 9; 214−1 =16,383 is not a multiple of 15; and 220−1 = 1,048,575 is not a multiple of 21 (nor even a multiple of 3). As a result of Fermat’s theorem, if a large number N has the property that 2N−1−1 is not a multiple of N, then we can be 100 percent sure that N is not prime, even without knowing what the factors of N are! However, the converse of Fermat’s theorem is not true. There do exist some composite numbers (called pseudoprimes) that behave like primes. The smallest example is 341 = 11×31, which has the property that 2340−1 is a multiple of 341. Although it’s been shown that pseudoprimes are relatively rare, there are an infinite number of them, but there are tests to weed them out.
Prime numbers have many applications, particularly within com-puter science. Primes are at the heart of nearly every encryption al-gorithm, including public key cryptography, which allows for secure financial transactions across the Internet. Many of these algorithms are
based on the fact that there are relatively fast ways to determine if a number is prime or not, but there are no known fast ways of factor-ing large numbers. For example, if I multiplied two random 1000-digit primes together and gave you their 2000-digit answer, it is highly un-likely that any human or computer (unless a quantum computer is built someday) could determine the original prime numbers. Codes that are based on our inability to factor large numbers (such as the RSA method) are believed to be quite secure.
People have been fascinated with prime numbers for thousands of years. The ancient Greeks said that a number is perfect if it is equal to the sum of all of its proper divisors (every divisor except itself). For example, 6 is perfect since it has proper divisors 1, 2, and 3, which sum to 6. The next perfect number is 28, which has proper divisors 1, 2, 4, 7, and 14, which sum to 28. The next two perfect numbers are 496 and 8128. Is there any pattern here? Let’s look at their prime factorizations.
6 = 2×3
28 = 4×7 496 = 16×31 8128 = 64×127
Do you see the pattern? The first number is a power of 2. The second number is one less than twice that power of 2, and it’s prime. (That’s why you don’t see 8×15 or 32×63 on the list, since 15 and 63 are not prime.) We can summarize this pattern in the following theorem.
Theorem: If 2n−1 is prime, then 2n−1× (2n−1)is perfect.
Aside
Proof:Let p=2n−1 be a prime number. Our goal is to show that 2n−1p is perfect. What are the proper divisors of 2n−1p? The divisors that do not use the factor p are simply 1, 2, 4, 8, . . . , 2n−1, which has sum 2n−1= p. The other proper divisors (which excludes 2n−1p) utilize the factor p, so these divisors sum to p(1+2+4+8+ · · · +2n−2) = p(2n−1−1). Hence the grand total of proper divisors is
p+p(2n−1− 1) =p(1+ (2n−1− 1)) =2n−1p as desired.
The great mathematician Leonhard Euler (1707–1783) proved that every even perfect number is of this form. As of this writing, there have
been forty-eight discovered perfect numbers, all of which are even. Are there any odd perfect numbers? Presently, nobody knows the answer to that question. It has been shown that if an odd perfect number exists, then it would have to contain over three hundred digits, but nobody has yet proved that they are impossible.
There are many easily stated unsolved problems pertaining to prime numbers. We have already stated that it is unknown whether there are infinitely many prime Fibonacci numbers. (It has been shown that there are only two perfect squares among the Fibonacci numbers (1 and 144) and only two perfect cubes (1 and 8).) Another unsolved problem is known as Goldbach’s conjecture, which speculates that every even num-ber greater than 2 is the sum of two primes. Here, too, nobody has been able to prove this conjecture, but it has been proved that if a counterex-ample exists, then it must have at least 19 digits. (A breakthrough was recently made on a similar-sounding problem. In 2013, Harald Helfgott proved that every odd number bigger than 7 is the sum of at most three odd primes.) Finally, we define twin primes to be any two prime num-bers that differ by 2. The first examples of twin primes are 3 and 5, 5 and 7, 11 and 13, 17 and 19, 29 and 31, and so on. Can you see why 3, 5, and 7 are the only “prime triplets”? And even though it has been proved (as a special case of a theorem due to Gustav Dirichlet) that there are infinitely many primes that end in 1 (or end in 3 or end in 7 or end in 9), the question of whether there exists an infinite number of twin primes remains open.
Let’s end this chapter with a proof that’s a little fishy, but I hope you agree with the statement anyway.
Claim:All positive integers are interesting!
Proof?: You’ll agree that the first few positive numbers are all very interesting. For instance, 1 is the first number, 2 is the first even number, 3 is the first odd prime, 4 is the only number that spells itself F-O-U-R, and so on. Now suppose, to the contrary, that not all numbers are interesting. Then there would have to be a first number, call it N, that was not interesting. But then that would make N interesting! Hence no
uninteresting numbers exist!