Study guide
Prime Numbers Explained: What They Are and Why They Matter
What prime numbers are, how to test whether a number is prime, the Sieve of Eratosthenes, why there are infinitely many primes and how primes protect online data.
Prime numbers are the building blocks of whole numbers. They appear in school maths, competitive exams and even in the security that protects your online banking. This guide explains what primes are, how to spot them quickly and why mathematicians have been fascinated by them for more than 2,000 years.
What is a prime number?
A prime number is a whole number greater than 1 that has exactly two factors: 1 and itself. For example, 7 is prime because it can only be divided exactly by 1 and 7. A whole number greater than 1 that is not prime is called a composite number; 12 is composite because it can be divided by 1, 2, 3, 4, 6 and 12.
The prime numbers below 50 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47.
Two facts often appear in quizzes: 1 is not a prime number, because it has only one factor, and 2 is the only even prime, because every other even number can be divided by 2.
How to test whether a number is prime
To check whether a number is prime, you only need to test whether it is divisible by the primes up to its square root. If none of them divide it exactly, the number is prime.
Example: is 97 prime? The square root of 97 is just under 10, so test 2, 3, 5 and 7. 97 is odd, its digits add up to 16 (not divisible by 3), it does not end in 0 or 5, and 7 × 13 = 91 and 7 × 14 = 98. None divide 97 exactly, so 97 is prime.
Divisibility rules help: a number is divisible by 3 if its digits add up to a multiple of 3, and by 5 if it ends in 0 or 5.
The Sieve of Eratosthenes
The Greek scholar Eratosthenes, who lived in the 3rd century BCE, described a simple way to list all the primes up to a chosen number:
- Write the numbers from 2 up to your limit, for example 100.
- Circle 2, then cross out every multiple of 2.
- Circle the next number not crossed out (3), then cross out all its multiples.
- Repeat with 5, then 7, and so on.
- The circled numbers left at the end are the primes.
Every number is built from primes
The Fundamental Theorem of Arithmetic states that every whole number greater than 1 can be written as a product of primes in exactly one way, apart from the order. For example, 60 = 2 × 2 × 3 × 5. This is called prime factorisation, and it is used to find the highest common factor (HCF) and lowest common multiple (LCM) of numbers.
Infinitely many primes
Around 300 BCE, Euclid proved that the primes never run out. His argument is elegant: suppose there were a final, largest prime. Multiply all the primes together and add 1. The new number leaves a remainder of 1 when divided by any of those primes, so either it is prime itself or it has a prime factor not on the list. Either way the list was incomplete, so there must be infinitely many primes.
Why primes matter today
Prime numbers are at the heart of modern cryptography. Systems such as RSA rely on the fact that multiplying two very large primes is easy, but working backwards to find those primes from their product is extremely hard for a computer. This helps keep online payments and messages secure.
Sharpen your number skills with the maths quizzes below.
Put it into practice
Number Sense and Arithmetic
Mathematics · Easy · 10 questions
Geometry and Shapes Quiz
Mathematics · Medium · 10 questions
Computer Fundamentals Quiz
Computer · Easy · 10 questions
More articles
What Is an Algorithm? Programming Basics for Beginners
A beginner-friendly explanation of algorithms: what they are, everyday examples, sequence, selection and loops, flowcharts and pseudocode, and searching and sorting.
The Seven Continents at a Glance
A quick guide to the seven continents: their size, population, famous features and key facts about Asia, Africa, the Americas, Antarctica, Europe and Australia.