Primes, HCF and LCM

Chapter 1 Study Notes · O-Level 4052

Section 3 of 11
Contents▾

1.2Trial Division

To test whether nn is prime you do not have to try every number below it. Test only the primes up to n\sqrt{n}. If n=a×bn = a \times b then one of aa and bb is at most n\sqrt{n}, so if nothing that small divides nn, nothing larger will either.

  1. Work out n\sqrt{n}.
  2. Divide nn by each prime up to n\sqrt{n}: 2,3,5,7,11,…2, 3, 5, 7, 11, \ldots
  3. One divides exactly, so nn is composite. None does, so nn 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▾
(a) Digit sum of 861861: 8+6+1=158 + 6 + 1 = 15, divisible by 33.
∴861\therefore 861 is composite (861=3×287861 = 3 \times 287).
(b) 509=22.6\sqrt{509} = 22.6 (to 1 d.p.), so test all primes ≤22\leq 22: 2,3,5,7,11,13,17,192, 3, 5, 7, 11, 13, 17, 19.
509509 is odd (not div. by 2), digit sum =14= 14 (not div. by 3), does not end in 0 or 5, and 509÷7=72.7…509 \div 7 = 72.7\ldots, 509÷11=46.2…509 \div 11 = 46.2\ldots, 509÷13=39.1…509 \div 13 = 39.1\ldots, 509÷17=29.9…509 \div 17 = 29.9\ldots, 509÷19=26.7…509 \div 19 = 26.7\ldots
∴509\therefore 509 is prime.

Now you try

To be sure 787787 is prime, what is the largest prime you would need to divide by?

Show solution▾
787=28.05(to 2 d.p.)\sqrt{787} = 28.05\quad \scriptsize\text{(to 2 d.p.)}
If 787=a×b787 = a \times b then one of aa and bb is at most 787\sqrt{787}, so nothing above 28 can divide 787787 unless something at or below it already does.
Primes up to 28: 2,3,5,7,11,13,17,19,232, 3, 5, 7, 11, 13, 17, 19, 23.
∴\therefore the largest prime you need to divide by is 23.

Want it marked, with hints, and a new question each time? Practise this →

Predict

Is 9191 prime? It is odd, its digits add to 1010, and it does not end in 00 or 55, so it passes the tests for 22, 33 and 55.

Show the answer▾
91=9.5\sqrt{91} = 9.5 (to 1 d.p.), so 77 is still on the list of primes to test.
91=7×1391 = 7 \times 13, so 9191 is composite.
Stopping at 22, 33 and 55 is the usual reason a composite number gets called prime.

Practise this

Questions on Primes, HCF and LCM, marked as you go, with the working shown.

Practise Primes, HCF and LCM