It’s pretty simple to multiply two numbers and get another number.
Here’s a question for you: What happens if we try to go the other way? For instance:
With a little thinking – remembering times tables, experimenting a bit – we can figure out the answer.
What we just did is called factoring. Instead of taking two little numbers and multiplying them to get a bigger number, we took a bigger number and broke it into two little numbers.
Let’s give this one a try:
No matter how hard we think, we can never come up with two smaller numbers that multiply to . The best we can do is to say , but we didn’t really break it down into anything smaller that way. When a number doesn’t have any factors besides and itself, we call it a prime number. When we can break it up, we call it a composite number. is a prime number. is a composite number.
Here’s another one to try:
With a little thinking, we might come up with this:
But what happens if we go a step further? What if we tried to factor the factors?
Try to solve this on your own first. I’ll wait.
Got it? Here’s the answer:
So we can write 24 like so:
We can’t break these factors down any more ( and are prime), so that’s as far as we can go.
“Wait a minute,” you might say. “I didn’t get . I got instead. Am I wrong?”
Good point. isn’t the only way we could have started factoring . You’re not breaking it apart wrong; you’re just breaking it apart in a different way. So let’s go down that path and see what we find.
Hm, this is interesting…
We get the same breakdown both times, even though we started in two different ways. Is this a coincidence?
As it turns out, it’s not. Anytime we break apart a composite number into its prime factors, no matter what path we take to get there, we’ll always arrive at the same result. In other words, every composite number has a unique prime factorization. This fact is so important it’s called the Fundamental Theorem of Arithmetic.
Prime numbers are arguably the most fundamental building blocks of an area of math called number theory. But even as fundamental as they are, they’re also surprisingly mysterious. They’ve fascinated and puzzled people through the ages, and even today we don’t know everything about them.
Let’s dive in and explore these special numbers. We’ll start by asking: How do we find prime numbers? Can we make a list of them?
Okay, let’s try. We’ll start at the beginning, at the number . is funny – it’s actually not a prime number. Remember, our definition says that a prime number’s only factors are and itself, and “ and itself” in this case means “ and ,” which doesn’t really fit the definition. It’s not composite, but it’s not prime either. So we leave out from our prime number list.
Now . is the first prime number. It’s also the only even prime number. (Can you figure out why?) Then comes , which is also prime. is not prime, since . But is a prime number: it’s not divisible by any of the primes smaller than itself, so we can’t break it up any further. is not prime, as we saw before: . But is prime; you can’t factor out any , , or (the primes smaller than ). is not prime; it’s divisible by as well. is not prime either, since . Neither is , since it’s also divisible by .
This is getting a little tiring. Every time we test a number to see if it’s prime, we have to check all the prime numbers smaller than it to see if any of them are factors. We’ve only checked the numbers up to so far, and we only have four primes: , , , . This might take an awfully long time if, for example, we were trying to see if is prime. There’s got to be a better way to find prime numbers.
Fortunately, we can take a couple of tactics to make our search easier. One way we can do this is by using what’s called the Sieve of Eratosthenes, named after a fellow from ancient Greece. Here’s how it works.
We start with a grid of all the numbers we want to test. (We’ll gray out because we already know it’s not prime.) For now we’ll just go up to , though you can extend the grid as far as you want.
We first circle the first prime number, which we already know is :
Now we count off every other number, shading them because we know they’re divisible by but they’re bigger than :
Right after is a number we haven’t shaded: . We circle this prime:
And then we shade every third number, thus eliminating all composite numbers divisible by . We might run into a number that’s already grayed out, and that’s fine – it’s already been marked composite, and composite it shall stay.
The number right after is grayed out, which means we’ve marked it as composite. (And it’s just as we expected, since .) So we skip over it and head to the next open number: . We do the same thing, circling it and shading all its multiples.
Onward we go. is grayed out, so we skip it and go to . As before, we circle the prime and shade its multiples.
Now we skip over , , and , and find that the next prime is :
We could keep going like this all the way to . (If we were using a bigger grid, we could go even further.) The composite numbers fall through the Sieve, and what we have left over – the circled numbers – are our primes.
But we can make this process even easier! At some point in our Sieve-making, the step of shading all the multiples of the current prime became trivial. Past , all the next multiples of our primes were past the end of the sieve. So once we hit that halfway point, we could just stop and circle all the surviving numbers. We can do even better than that, though: we only need to check numbers up to the square root of the size of the sieve. (Read that again, slowly, and try to figure out why it’s true. Hint: look what happened when we marked the multiples of .)
Anyway, here’s the resulting list of primes less than :
The list proceeds in skips and hops of irregular length. There’s no clear pattern to the primes – we can only guess where exactly the next one might land.
For that matter, how do we know for certain there’s a “next one” at all? Might the list just stop at some point? Is there a biggest prime? After all, it makes intuitive sense that primes should become scarcer as they get bigger.
It turns out that there are an infinite number of primes: there is no “biggest” one, because if there were, you could always find one that’s bigger. We can prove it, too!
We’ll start by assuming that there’s a biggest prime, so that if we make a list of all the primes we’ll eventually get to the end. Now let’s use this list to build an even bigger number that has to be prime. What we’ll do is multiply all the primes in our list together, and then add . This new (huge) number isn’t divisible by , because it’s more than a multiple of ; it’s not divisible by , because it’s more than a multiple of ; it’s not divisible by , because it’s more than a multiple of ; and so on through all the primes on our list, all the way up to the biggest prime. Therefore, our new huge number must be prime. But that makes no sense! We assumed there were no primes bigger than the last prime on our list, and now we’ve contradicted ourselves by saying there’s something bigger than the biggest. So our assumption must be wrong. There is no biggest prime.
“Okay,” you might say. “So we can just use this method to keep generating more primes, right? We can start with, say, , and calculate it out to , and hey presto, it’s prime!”
Not necessarily. The numbers you’re talking about, where you multiply the first primes and then add , are called Euclid numbers, and they’re not always prime (though they certainly can be, as in your example).
“Why not? Isn’t that what we did in our proof just now? We built a Euclid number and knew it had to be prime?”
Well, not quite. See, we only knew our new huge number was prime because we assumed that we knew what the biggest prime in the world was. But now we know that our assumption was false. So if there’s another prime between our “biggest prime” and our Euclid number, it could potentially gum up the works. Just say we multiply all the primes up to and make a Euclid number from that:
But is not prime: . This is an example where two primes ( and ) between our “biggest prime” () and our Euclid number () happened to be factors of our Euclid number.
“Okay,” you reply. “So that algorithm doesn’t always give us primes. Is there some other algorithm that will?”
This is a very good question, and one that has baffled mathematicians for years. There have been many valiant attempts at solving this conundrum.
For instance, a mathematician named Pierre de Fermat came up with this formula:
Fermat thought that this formula would always result in primes, no matter what you stuck into it. And the first four Fermat numbers, as they’re called, are indeed prime. (This was back in the days before calculators, so Fermat figured that all out on paper, which was a big deal.) But the formula breaks down at :
In fact, all the Fermat numbers bigger than this that we’ve calculated so far have been composite. So that didn’t work.
Another such formula is this one, invented by a person named Marin Mersenne:
Numbers in this form are called Mersenne numbers, and if a Mersenne number is prime it’s called a Mersenne prime. The first few Mersenne primes are , , , and .
Not every that we plug into the formula will result in a prime number. But it turns out we can be even more specific: if is composite, then must also be composite. Does that mean that plugging in a prime will give us a prime Mersenne number? No, not always. If we let , for example, then we get
So a prime doesn’t guarantee a Mersenne prime. Nevertheless, Mersenne primes are still very important – most record-breaking prime numbers are Mersenne primes. The biggest number so far that we know to be a prime is
That is an absolutely ginormous Mersenne prime. When you calculate it out, it has over million digits. Just to get a sense for how ginormous that is, the number of atoms in the observable universe has about digits.
The distribution of prime numbers is still at the cutting edge of mathematics today. The most recent development in the quest to find a formula for them is called the Riemann hypothesis, which is one of the greatest unsolved problems in mathematics today. The Riemann hypothesis basically says that the numbers that make a certain function equal to zero all have to be in the form (for some ); these numbers can then be used in another formula that tells how many prime numbers are less than any given number. It might sound a bit roundabout, but if it’s proven, the Riemann hypothesis would give us a way to predict the distribution of prime numbers with remarkable accuracy. So far it’s been over years, and nobody’s proven it yet!
Prime numbers, those that can’t be broken down into smaller factors, are simple to start playing with but intriguingly complex to fully master. Who knows – maybe you’ll be the next one to discover something new about these enigmatic numbers!