- Factors and multiples
- Times tables — patterns and strategies · coming soon
- HCF and LCM
- Index notation and the basic laws
- RSA cryptography · coming soon
Seven tiles, and the numbers that refuse to make a rectangle
In the last lecture, 24 tiles made four different rectangles: 1 row of 24, 2 rows of 12, 3 rows of 8 and 4 rows of 6. Now try the same with 7 tiles.
Rows of 2 do not work. Three rows of 2 use 6 tiles, and 1 tile is left over. Rows of 3 do not work either. In fact, nothing works except one long row of 7. The number 7 cannot be made into a rectangle with more than one row.
Here are four numbers: 51, 57, 61 and 91. Which of them can only make one long row? Most people pick three of them, or all four. They are all odd, and none is in the times tables most people know by heart. But only 61 really refuses. The others break apart: , , and the last lecture showed that .
So "it looks unbreakable" is not a test. This lecture gives these numbers their name, a test that never fails, and the reason they matter: every whole number greater than 1 is built from them, in only one way.
Exactly two factors
Start with the factors of the numbers from 1 to 12, and count them.
| Number | Factors | How many |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 1, 2 | 2 |
| 3 | 1, 3 | 2 |
| 4 | 1, 2, 4 | 3 |
| 5 | 1, 5 | 2 |
| 6 | 1, 2, 3, 6 | 4 |
| 7 | 1, 7 | 2 |
| 8 | 1, 2, 4, 8 | 4 |
| 9 | 1, 3, 9 | 3 |
| 10 | 1, 2, 5, 10 | 4 |
| 11 | 1, 11 | 2 |
| 12 | 1, 2, 3, 4, 6, 12 | 6 |
Every number from 2 upwards has at least two factors, because 1 and the number itself always divide into it exactly. Some numbers have only those two: 2, 3, 5, 7 and 11 in this table. They are the numbers that make only one rectangle.
A prime number is a whole number greater than 1 that has exactly two factors: 1 and itself.
A composite number is a whole number greater than 1 that has more than two factors.
The word "composite" means "put together". A composite number can be made by multiplying two smaller whole numbers, as . A prime cannot. Two numbers need a closer look, and each one has a reason.
1 is not prime. It has only one factor, which is 1. A prime needs exactly two. So 1 is neither prime nor composite. There is also a deeper reason, which comes later in this lecture.
2 is the only even prime. Its factors are 1 and 2, so it is prime. Every other even number, such as 4, 6 or 38, is divisible by 2 as well as by 1 and by itself. That makes at least three factors. So no other even number can be prime.
Every prime except 2 is odd. Does that mean every odd number greater than 1 is prime?
Show the answer
No. The rule works in one direction only. Being odd tells you only that 2 is not a factor. Other factors are still possible: 9, 15 and 21 are odd and composite, and so are 51, 57 and 91.
Testing a number: which divisions do you really need?
Is 97 prime? You could divide it by every number from 2 to 96, but almost all of those divisions are wasted. Two ideas cut the work down.
First idea: stop early. The last lecture found factors in pairs, one small and one large. It stopped when the next test, multiplied by itself, was bigger than the number. The same rule works here. If 97 had a factor pair, the smaller number of the pair would be at most 9. This is because , which is already bigger than 97. So you only need to test numbers up to 9.
Second idea: test only primes. Suppose 4 divided into a number exactly. Then 2 would divide into it too, because . So if 2 fails, then 4, 6 and 8 must fail as well, and you can skip them. In the same way, if 3 fails, then 9 fails. You only need to test the primes.
Put the two ideas together for 97. Test 2, 3, 5 and 7.
- 97 is odd, so 2 does not divide it.
- remainder 1.
- remainder 2.
- remainder 6.
The next prime is 11, and , which is bigger than 97. So stop. Nothing divided exactly, so 97 is prime. Four divisions did the work of ninety-five.
Divide the number by the primes 2, 3, 5, 7, 11, … in order.
If one of them divides exactly, the number is composite.
If you reach a prime that, multiplied by itself, is bigger than the number, and nothing has divided exactly, the number is prime.
A sieve that catches every prime up to 100
To find every prime up to 100, there is a faster and very old way. Instead of testing each number, you remove the numbers that are not prime. The method is called the sieve of Eratosthenes, after a Greek scholar of the third century BCE. His own writing does not survive. The oldest description is in a book by Nicomachus of Gerasa, written around 100 CE, which names Eratosthenes as the inventor.
Cross out 1. The first number left is 2, so 2 is prime: cross out its multiples. The next number still standing is 3, so 3 is prime: cross out its multiples. Keep going. Each new number still standing must be prime, because no smaller number divided into it. Otherwise it would have been crossed out already.
Press Next step to run one round of the sieve, or Play to watch the numbers being crossed out one at a time. Numbers crossed out in the current round are marked in colour. Watch the pattern each prime makes in the grid.
The grid shows the numbers from 1 to 100 after the sieve has finished. The 25 primes are ringed. Every other number has been crossed out.
| Round | Cross out | New numbers crossed out |
|---|---|---|
| 1 | the number 1 | 1 |
| 2 | multiples of 2, from 4 | 49 |
| 3 | multiples of 3, from 9 | 16 |
| 4 | multiples of 5, from 25 | 6 |
| 5 | multiples of 7, from 49 | 3 |
That is 75 numbers crossed out, which leaves 25 primes.
What should you have seen? The multiples of 2 make five straight columns, and the multiples of 3 make slanting lines. Each round crosses out fewer new numbers: 49, then 16, then 6, then only 3. Two things need a reason.
Why does the round for 7 start at 49? The smaller multiples of 7 are 7 times 2, 3, 4, 5 or 6. So each one is also a multiple of 2, 3 or 5, and an earlier round has crossed it out. The first multiple of 7 still standing is .
Why can the sieve stop after 7? The next prime is 11. Its first new multiple would be , which is past 100. So every number up to 100 that is still standing has no smaller factor, and it is prime. This is the stopping rule from the last lecture again, now working on a whole table at once.
The result is 25 primes up to 100:
Apart from 2 and 5, every prime ends in 1, 3, 7 or 9. This is because a number ending in 0, 2, 4, 6 or 8 is even, and a number ending in 0 or 5 is a multiple of 5. But ending in 1, 3, 7 or 9 does not make a number prime, as 51 and 91 show. Sort some numbers yourself, using the test and not the look of the number.
Put each number in a box. For each one, ask: does a prime smaller than it divide into it exactly?
Each number is placed by testing the primes 2, 3, 5, 7, … in order.
| Number | Type | Reason |
|---|---|---|
| 2 | prime | factors 1 and 2 only |
| 61 | prime | 2, 3, 5 and 7 all leave a remainder, and is bigger than 61 |
| 97 | prime | 2, 3, 5 and 7 all leave a remainder |
| 51 | composite | |
| 57 | composite | |
| 91 | composite | |
| 49 | composite | |
| 1 | neither | only one factor |
Every number is built from primes
Here is why primes matter so much. Take any composite number and split it into a factor pair. If either part is composite, split that part too. Keep splitting until no part can be split. What is left at the end is a list of primes that multiply to give the number.
The picture of this is a factor tree. Start with 84. One factor pair is . Then and . Now every branch ends in a prime, so the tree is finished.
Multiply the primes at the ends of the branches:
The small raised 2 is a short way to write "2 multiplied by itself", so . It is read "2 squared". The lecture on index notation does much more with it. Here it only saves writing. Writing a number as a product of primes like this is called its prime factorisation.
The second tree starts with a different pair, , and has a different shape. But the primes at the ends are the same. Try other starts, such as or . You always arrive at the same primes.
Every whole number greater than 1 is either a prime, or a product of primes.
This product is always the same, apart from the order of the primes, however you find it.
"Fundamental" means "at the base of everything". Primes are the building blocks of multiplication, as atoms are the building blocks of matter. Every whole number has its own recipe of primes.
The first half of the theorem is easy to see from the tree: you can always keep splitting. The second half, that the recipe is always the same, is much harder to prove. Euclid, around 300 BCE, proved the key step, and Carl Friedrich Gauss published the first complete proof in 1801.
The theorem also gives the deeper reason why 1 is not prime. Suppose we called 1 a prime. Then and would be two different prime factorisations of 84. So would , and so on forever. Leaving 1 out keeps every recipe unique. Mathematicians choose definitions so that the important facts stay true.
The primes never run out
The primes thin out: 25 up to 100, but only 21 between 100 and 200. Could they stop altogether? About 2300 years ago, Euclid proved that they never stop. His idea is short, but it is the hardest step in this lecture. Read it slowly.
Suppose someone claims that 2, 3 and 5 are the only primes. Multiply them all, then add 1:
Now divide 31 by 2, by 3 or by 5. Each division leaves a remainder of 1. This is because 30 is a multiple of each of them, and 31 is one more than 30. So none of the claimed primes divides 31.
So either 31 is itself a new prime, or it is built from primes that are not on the list. Either way, the list was missing a prime.
Does "multiply the primes and add 1" always give a prime? Try the list 2, 3, 5, 7, 11 and 13.
Show the answer
No. , and . This number is not prime, because .
But the argument still works. Each prime on the list leaves a remainder of 1, so the factors 59 and 509 are new primes that were missing. The new number does not have to be prime. It only has to be built from primes that are not on the list.
The same move works for any list of primes, however long. That is it. That is the whole idea. No list of primes can ever be complete, so there are infinitely many primes.
Worked examples
119 looks as if it might be prime. Since is bigger than 119, test only 2, 3, 5 and 7.
- 119 is odd, so 2 does not divide it.
- remainder 2.
- 119 does not end in 0 or 5, so 5 does not divide it.
- exactly.
So , and 119 is composite.
Check: .
Instead of a tree, divide by the smallest prime that fits, again and again, until you reach 1.
- . 45 is odd, so 2 no longer fits. Move to 3.
- . 3 no longer fits. Move to 5.
- . Stop.
The primes you divided by are the prime factorisation:
Here , read "2 cubed".
Check: and , so the product is .
You know that . Without dividing, decide whether 84 is divisible by 6, by 9 and by 14.
Every factor of 84 is made from some of 84's own primes. So write each test number in primes, and look for them in 84's recipe.
- . 84 has a 2 and a 3, so 6 is a factor. The primes left over, , give the partner: .
- . This needs two 3s, but 84 has only one. So 9 is not a factor.
- . 84 has both, so 14 is a factor. The primes left over are , so .
Check: remainder 3, so 9 is indeed not a factor. And .
This idea, that factors share primes, is exactly what the next lecture uses to find the highest common factor of two numbers.
1 has only one factor, so it is not prime, and it never appears in a prime factorisation. "" is not a prime factorisation.
Odd numbers that are not in the familiar times tables often look prime: 51, 57, 87, 91, 119. Each one is composite. 51, 57 and 87 are multiples of 3, while 91 and 119 are multiples of 7. Always test.
A student writes and stops. But 4 and 9 are not prime, so each must be split again. The full answer is . Before you finish, check that every number at the end of a branch is prime.
Work each one on paper first. Open a hint only when you are stuck.
-
Which of these numbers are prime: 1, 41, 49, 53, 87, 221? For each one that is not prime, say why.
Hint 1
Use the test. Divide by 2, 3, 5, 7, … and stop when the prime multiplied by itself is bigger than the number.
Hint 2
For 221, you need to test up to 13, because is less than 221 but is bigger.
Full answer
1 is neither prime nor composite: it has only one factor.
41 is prime: 2, 3 and 5 leave remainders, and is bigger than 41.
49 is composite: .
53 is prime: 2, 3, 5 and 7 leave remainders ( remainder 4), and is bigger than 53.
87 is composite: .
221 is composite. 2, 3, 5, 7 and 11 all leave remainders, but exactly, so .
Check: .
-
Write 126 and 180 as products of primes. Use the short form with raised numbers where a prime appears more than once.
Hint 1
Divide by the smallest prime that fits, again and again, as in Worked Example 2.
Hint 2
. Now 2 no longer fits, so try 3.
Full answer
126: , , , and 7 is prime. So .
180: , , , , and 5 is prime. So .
Check: and .
-
A number has the prime factorisation . Without working out , decide whether is divisible by (a) 8, (b) 9, (c) 10, (d) 60.
Hint 1
Write each test number as a product of primes.
Hint 2
Then check whether has enough of each prime. Remember means three 2s.
Full answer
(a) . has three 2s, so yes.
(b) . has only one 3, so no.
(c) . has a 2 and a 5, so yes.
(d) . has at least two 2s, a 3 and a 5, so yes.
Check: . Then , and , all exact, while remainder 3.
-
The number 589 is the product of two primes. Find them. Then explain why the same job would be much harder for a number with 600 digits.
Hint 1
The smaller of the two primes is at most the stopping point. and .
Hint 2
So test the primes up to 23: 2, 3, 5, 7, 11, 13, 17, 19, 23.
Full answer
2, 3, 5, 7, 11, 13 and 17 all leave remainders. Then exactly. So , and both are prime.
Here you needed at most nine divisions. For a number with 600 digits, the stopping point is a number with about 300 digits. The list of primes below it is unimaginably long, far too long to test one by one. Going from the two primes to their product is one multiplication. Going back from the product to the primes is the hard direction.
Check: .
Multiplying two primes is quick. Finding them again from their product can be extremely slow. In 1977, Ron Rivest, Adi Shamir and Leonard Adleman built a way of protecting messages on this one-way difference, called RSA from their initials. In a typical key today, a public number is the product of two secret primes, each about 300 digits long. As far as anyone knows, no ordinary computer can recover the primes in any useful amount of time. Much of the security of online payments has rested on this, although researchers are preparing new methods in case future quantum computers can do it.
Primes are still being discovered. In October 2024, Luke Durant, working with a volunteer project called GIMPS, found that is prime. It has 41 024 320 digits, and it is the largest prime known. Euclid's argument guarantees that a bigger one is waiting.
- A prime number is a whole number greater than 1 with exactly two factors, 1 and itself, and a composite number has more than two.
- 1 is neither prime nor composite, and 2 is the only even prime because every other even number also has 2 as a factor.
- To test a number, divide by the primes in order and stop when a prime multiplied by itself is bigger than the number.
- Every whole number greater than 1 is a prime or a product of primes, and its prime factorisation is the same however you find it.
- There are infinitely many primes, because multiplying any list of primes and adding 1 always leads to a prime that is not on the list.