What are prime numbers?
Primes are the building blocks of every whole number, they never run out, and they guard your secrets online. Grab a pencil and sift them out with a 2,000-year-old trick.
The numbers that will not split
Try sharing 12 lollies into equal piles. You can make 2 piles of 6, 3 piles of 4, 4 piles of 3 or 6 piles of 2. Now try 13. The only ways are 1 pile of 13 or 13 piles of 1. Numbers like 13 are special. We call them prime numbers.
A prime number is a whole number bigger than 1 that has exactly two factors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A whole number bigger than 1 with more than two factors, like 12, is called a composite number, because it is composed, or built, from smaller numbers.
Notice that 2 is prime. It is the only even prime, because every other even number can be divided by 2. Mathematicians like to joke that this makes 2 the oddest prime of all.
Why 1 misses out
Is 1 a prime? It has only one factor, itself, so it does not fit the rule. Mathematicians say 1 is neither prime nor composite. Long ago some people did count 1 as a prime, but there is a good reason we no longer do.
Every whole number bigger than 1 can be built by multiplying primes together, and there is only one way to do it. For example, 36 = 2 ร 2 ร 3 ร 3, and no other collection of primes multiplies to 36. This rule is so important that it has a grand name: the fundamental theorem of arithmetic. Primes are like the atoms of the number world. Everything else is made from them.
If 1 were a prime, the rule would break. You could write 36 = 1 ร 2 ร 2 ร 3 ร 3, or 1 ร 1 ร 2 ร 2 ร 3 ร 3, and keep going forever. Leaving 1 out keeps the building blocks tidy.
A sieve for numbers
More than 2,200 years ago, a Greek scholar named Eratosthenes ran the great library at Alexandria in Egypt. He worked out the size of the Earth by measuring shadows, and his answer was remarkably close. Other scholars nicknamed him Beta, the second letter of the Greek alphabet, because he came second in almost every subject. He was also a fine mathematician, and he invented a simple way to catch primes.
His method works like a kitchen sieve. Write out the numbers from 1 to 100. Cross out 1. Circle 2, then cross out every other multiple of 2: 4, 6, 8 and so on. Circle the next number still standing, 3, and cross out its multiples. Do the same for 5, then 7.
That is all it takes. Every number left uncrossed is prime, and you will find exactly 25 of them below 100. Computers still use versions of the sieve of Eratosthenes to hunt for primes today.
They never run out
Primes get rarer as numbers grow. There are 25 primes below 100, but only 168 below 1,000 and 1,229 below 10,000. So do they eventually stop? Around 300 BC, the Greek mathematician Euclid proved that they never do, and his argument is one of the most famous in all of mathematics.
Imagine you have a list of every prime there is. Multiply them all together and add 1. Your new number cannot be divided evenly by any prime on your list, because there is always 1 left over. So either the new number is itself a prime, or it is built from primes you forgot. Either way, your list was not complete. Try it: 2 ร 3 ร 5 ร 7 + 1 = 211, which is prime. And 2 ร 3 ร 5 ร 7 ร 11 ร 13 + 1 = 30,031 = 59 ร 509, two primes that were not on the list.
Because the primes go on forever, the hunt for bigger ones never ends. The largest prime known, found in October 2024, is 136,279,841 twos multiplied together, minus 1. Written out, it has 41,024,320 digits. Luke Durant, a volunteer with the Great Internet Mersenne Prime Search, found it using thousands of graphics chips in data centres across 17 countries.
Primes keep your secrets
Every time someone pays for something online, primes are working behind the scenes. A system called RSA picks two enormous primes, each hundreds of digits long, and multiplies them together. The answer is published openly as a key that locks messages. Multiplying is easy, but working backwards to find the two primes from their product is so hard that even the fastest computers would take practically forever. Only the person who knows the two primes can unlock the message.
Primes may even turn up in nature. In eastern North America, periodical cicadas spend 13 or 17 years underground before millions crawl out at once. Both numbers are prime, and one idea is that prime-length cycles rarely line up with the shorter life cycles of predators or other cicadas. Scientists are still not sure that this is the reason.
๐ Words to know
- Prime number
- A whole number bigger than 1 with exactly two factors, 1 and itself, such as 2, 3, 5, 7 and 11.
- Composite number
- A whole number bigger than 1 with more than two factors, such as 4, 6, 8, 9 and 12.
- Factor
- A whole number that divides into another number exactly. The factors of 10 are 1, 2, 5 and 10.
- Multiple
- The result of multiplying a number by a whole number. The multiples of 7 are 7, 14, 21, 28 and so on.
- Encryption
- Scrambling a message so that only someone with the right key can read it.
๐งช Try this: sift out the primes
- Draw a grid 10 squares wide and 10 squares tall, and write the numbers 1 to 100 in it, one per square. Cross out 1: it is not prime.
- Circle 2. Then cross out every other multiple of 2 (4, 6, 8 โฆ 100). Circle the smallest number not yet crossed out, 3, and cross out its multiples (6, 9, 12 โฆ). Some will already be gone.
- Repeat with 5 and then 7. Now you can stop: any number below 100 that is not prime has a factor of 7 or less, because 11 ร 11 = 121 is already too big.
- Circle everything that is left. Count the circles: you should have exactly 25 primes. Look at their last digits. Apart from 2 and 5, every prime ends in 1, 3, 7 or 9. Can you work out why?
- Challenge: extend your grid to 200. Which extra numbers do you need to sieve with now, and where can you stop?
๐ง Quick check
4 questionsWhere this comes from
We check our facts against trusted sources. Want to find out more? Try these:
- Prime Number โ Wolfram MathWorld
- Why is the number one not prime? โ The Prime Pages (University of Tennessee at Martin)
- Eratosthenes of Cyrene โ MacTutor History of Mathematics (University of St Andrews)
- Prime numbers โ MacTutor History of Mathematics (University of St Andrews)
- Euclid's Theorems โ Wolfram MathWorld
- Prime Counting Function โ Wolfram MathWorld
- List of known Mersenne prime numbers โ Great Internet Mersenne Prime Search
- Prime passion: finding a 41-million-digit prime number โ CSIRO Double Helix
- Prime numbers keep your encrypted messages safe: here's how โ ABC News (2018)
- Periodical cicada information pages โ University of Connecticut
- Goldbach Conjecture โ Wolfram MathWorld
Keep exploring
๐ Maths
Why do bees build honeycomb out of hexagons?
Six-sided cells fit together with no gaps and use the least wax. People puzzled over it for 2,000 years before a mathematician proved the bees had it right.