What is a prime number?
A prime number has exactly two factors: 1 and itself. 2, 3, 5, 7, 11 and 13 are prime; 9 (3 × 3) and 15 (3 × 5) are not. 1 is not prime, and 2 is the only even prime.
How to check if a number is prime
- If it ends in 0, 2, 4, 6 or 8 (and isn't 2), it's not prime.
- If its digits add up to a multiple of 3, it's divisible by 3.
- Otherwise, try dividing by primes up to its square root. If none divides it, it's prime.
Example: 97 — √97 ≈ 9.8, so try 2, 3, 5, 7. None divides 97, so it's prime.
Prime numbers from 1 to 100
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 — 25 primes in all.