1.2Trial Division
To test whether is prime you do not have to try every number below it. Test only the primes up to . If then one of and is at most , so if nothing that small divides , nothing larger will either.
- Work out .
- Divide by each prime up to :
- One divides exactly, so is composite. None does, so is prime.
Testing large numbers for primality
For each number below, state whether it is prime or composite, and give your reasoning: (a) 861 (b) 509
Show solution▾
Now you try
To be sure is prime, what is the largest prime you would need to divide by?
Show solution▾
Want it marked, with hints, and a new question each time? Practise this →
Predict
Is prime? It is odd, its digits add to , and it does not end in or , so it passes the tests for , and .