What is a prime number?
A prime number has exactly two divisors: 1 and itself. The first few are 2, 3, 5, 7, 11, 13, 17, 19. A number with more divisors, like 12, is composite.
- 2 is the only even prime. Every other even number divides by 2.
- 1 is not prime. It has only one divisor, and a prime needs two.
- 0 is neither prime nor composite.
How to test a number
You only need to try divisors up to the square root. Divisors come in pairs that multiply to the number, so if there is a small one there is always a partner below the square root too.
Is 97 prime? √97 is about 9.8, so test 2, 3, 5 and 7. None of them divides 97 exactly, so 97 is prime. The calculator goes a step faster: after 2 and 3, every prime is of the form 6k − 1 or 6k + 1, so it skips the rest.
Prime factorisation
Every whole number above 1 breaks into primes in exactly one way. For example 360 = 2³ × 3² × 5. This is called the fundamental theorem of arithmetic.
The factorisation also tells you how many divisors a number has. Add 1 to each power and multiply: 360 has (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors.
Some facts worth knowing
- There are infinitely many primes. Euclid showed this more than 2,000 years ago.
- Primes that differ by 2, like 11 and 13 or 29 and 31, are called twin primes.
- The Sieve of Eratosthenes finds all primes up to a limit by crossing out multiples of each prime in turn.
- Large primes protect online banking. Multiplying two big primes is easy, but splitting the result back into them is extremely hard, and encryption such as RSA relies on that.