🔢
Math🚀 Ages 7-10Beginner 8 min read

Prime Numbers

Discover prime numbers: what makes a number prime, why 1 is not prime, how to test for primes, and the Sieve of Eratosthenes — with worked examples and a quiz.

Key takeaways

  • A prime number has exactly two different factors: 1 and itself
  • A composite number has more than two factors
  • The number 1 is neither prime nor composite because it has only one factor
  • 2 is the only even prime number — every other even number can be divided by 2

What is a prime number?

Every whole number bigger than 1 can be sorted into one of two groups. The secret to sorting them is to look at their factors — the whole numbers that divide into them exactly with nothing left over.

A prime number is a whole number greater than 1 that has exactly two factors: the number 1 and the number itself. Nothing else divides into it evenly.

For example, 7 is prime. Try dividing it: 7 ÷ 1 = 7 and 7 ÷ 7 = 1 both work, but 7 ÷ 2, 7 ÷ 3, 7 ÷ 4, 7 ÷ 5 and 7 ÷ 6 all leave a remainder. So 7 has only two factors, 1 and 7. That makes it prime.

If you want a reminder of what factors are, see our Factors and Multiples lesson.

Prime or composite?

A number with more than two factors is called a composite number. It can be built by multiplying smaller numbers together.

Look at 12. Its factors are 1, 2, 3, 4, 6 and 12 — that is six factors, far more than two. So 12 is composite. We can write it as 3 × 4 or 2 × 6.

NumberFactorsPrime or composite?
21, 2Prime
31, 3Prime
41, 2, 4Composite
51, 5Prime
61, 2, 3, 6Composite
71, 7Prime
91, 3, 9Composite

Why 1 is not prime

This surprises a lot of people, so let's look at the why. The number 1 has only one factor — itself. A prime must have exactly two different factors. Since 1 falls short of two factors, it cannot be prime. But it isn't composite either (it has fewer than three factors), so 1 sits all on its own: it is neither prime nor composite.

Why 2 is special

2 is the only even prime number. Here is the reason: every even number can be divided by 2. For numbers like 4, 6, 8 and 10, that gives them an extra factor on top of 1 and themselves, making them composite. But 2 divided by 2 is just 2 itself — so 2 still has only the two factors 1 and 2. After 2, every prime number is odd.

How to test if a number is prime

Here is a simple method to test a number, using 24 and then 23 as examples.

Example 1 — Is 24 prime?

  1. Try dividing by 2: 24 ÷ 2 = 12, no remainder.
  2. We already found a factor other than 1 and 24.
  3. So 24 has more than two factors. 24 is composite.

Example 2 — Is 23 prime?

  1. Try 2: 23 ÷ 2 leaves a remainder (23 is odd).
  2. Try 3: 23 ÷ 3 leaves a remainder.
  3. Try 4: leaves a remainder. Try 5: leaves a remainder.
  4. You only need to test up to a number that, when multiplied by itself, reaches 23. Since 5 × 5 = 25 is already past 23, you can stop.
  5. Nothing divided evenly, so 23 is prime.

A useful shortcut: you only have to test divisors up to the square root of the number. If nothing below that works, the number is prime. This saves a lot of time with big numbers.

The Sieve of Eratosthenes

More than 2,000 years ago, a Greek thinker named Eratosthenes invented a clever way to find all the primes up to a number. It works like a sieve that catches the composite numbers and leaves the primes behind.

Try it yourself on a grid of 1 to 30:

  1. Cross out 1 — it is not prime.
  2. Circle 2, then cross out every other multiple of 2 (4, 6, 8, ...).
  3. Circle 3, then cross out every multiple of 3 (6, 9, 12, ...).
  4. Circle 5, then cross out every multiple of 5 (10, 15, 20, ...).
  5. The numbers still circled are the primes.

The primes up to 30 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.

A practice activity

Make your own number hunt:

  1. Write the numbers 1 to 50 in a grid of ten columns.
  2. Use the sieve method above to cross out composites and circle primes.
  3. Count how many primes you found. (You should find 15 primes up to 50.)
  4. Challenge: find a pair of primes that are exactly 2 apart, called "twin primes" — for example 11 and 13, or 17 and 19.

Where this leads

Prime numbers are the building blocks of all whole numbers, because every composite number can be broken down into a product of primes. This idea, called prime factorisation, helps you simplify fractions and find common denominators. Practise spotting primes whenever you see a number, and revisit Odd and Even Numbers to sharpen the skills that help you test for primes quickly.

Quick quiz

Test yourself and earn XP

Which of these is a prime number?

Why is the number 1 NOT a prime number?

Which is the only even prime number?

Is 21 prime or composite?

How many factors does a prime number have?

FAQ

Yes. More than 2,000 years ago a Greek mathematician named Euclid proved that the primes never run out — no matter how high you count, there is always another prime waiting.

Big prime numbers are used to keep information safe online. The codes that protect your passwords and bank details rely on the fact that multiplying two huge primes is easy, but un-multiplying the answer is extremely hard.