← Math Concepts

Prime Numbers

Use small divisors, odd and even patterns, and factorization to tell when a number can be prime.

Key Ideas

Know what counts as prime

A prime has exactly two positive factors, 1 and itself. Composite numbers have more than two. The number 1 is neither. The only even prime is 2.

Stop at the square root

To test a positive integer n greater than 1, check prime divisors up to √n. If n is composite, at least one prime factor is no larger than its square root.

Use parity in prime sums

Every prime other than 2 is odd. For example, if three distinct primes sum to an even number, one of them must be 2. Then list the remaining pair from smaller to larger to avoid counting it twice.

Look for a product

If you can factor an expression into two positive integers greater than 1, it is composite. When the expression has to be prime, check when one factor equals 1 and the other is prime.

Go Further

Find every prime in a range

To find primes through 30, start with 2 through 30. Keep 2, 3, and 5 and cross out their larger multiples. Every composite through 30 has a prime factor at most √30, so the numbers left are exactly the primes.

Try It Yourself

1. Which Locker Number Is Prime?

Four locker labels read 77, 83, 87, and 91. Exactly one is prime. Which one?

All four labels are below 100. Only test prime divisors below 10.
Show hint

Check divisibility by 2, 3, 5, and 7.

Show solution

77 = 7 × 11, 87 = 3 × 29, and 91 = 7 × 13. None of 2, 3, 5, or 7 divides 83, so 83 is prime.

2. Three Prime Scores

A puzzle uses three distinct prime scores that add up to 42. How many sets of three scores are possible? The order of the scores does not matter.

The total is even. Think about what happens if all three scores are odd.
Show hint

One score must be 2. Why is it enough to check smaller prime scores up to 19 for the remaining pair?

Show solution

The other two primes sum to 40, so the smaller is below 20. Checking 3, 5, 7, 11, 13, 17, and 19 gives the pairs (3, 37), (11, 29), and (17, 23). There are 3 sets.

3. A Prime from a Formula

For which positive integers n is n2 + 4n − 5 prime?

Factoring gives you a way to check an unlimited number of inputs at once.
Show hint

Find two integers whose product is −5 and whose sum is 4.

Show solution

The expression factors as (n − 1)(n + 5). At n = 1, it is zero. At n = 2, it is 1 × 7, which is prime. For every n ≥ 3, both factors are greater than 1. The only answer is n = 2.

Watch Next

Primes and Composites

Review how to distinguish prime numbers from composite numbers with Shark Academy.

Watch on Bilibili · Watch on YouTube