Primes and the Euclidean algorithm
Prime decomposition
A prime has exactly two factors: 1 and itself. Composite numbers can be broken into smaller factors, and if you keep breaking until only primes remain — by a factor tree, or by repeatedly dividing by 2, then 3, then 5, and so on — you get the prime decomposition, usually written in index form: .
The fundamental theorem of arithmetic says every number has exactly one prime decomposition, no matter how you find it. This is also why 1 is not counted as a prime: allowing factors of 1 would create endless “different” decompositions.
LCM and GCD from primes
Write each number as a product of primes first, then:
- gcd (HCF): take only the primes common to both, each at its lowest index.
- lcm: take every prime that appears, each at its highest index.
For and :
Coprime numbers
If two numbers share no prime factors, their gcd is 1 and they are called coprime (or relatively prime) — for example and . For coprime numbers the lcm is simply their product.
The Euclidean algorithm
Factorising big numbers is hard work, and the Euclidean algorithm finds a gcd without any factorising. The idea: any common divisor of two numbers also divides their difference — and therefore the remainder after division. So repeatedly replace the larger number with the remainder:
- : remainder , so look at
- remainder , so look at
- remainder — stop.
The gcd is the last positive remainder: .
Choose your tool: prime decomposition when the numbers factorise easily, the Euclidean algorithm when they are large or awkward.
You'll get instant feedback after each answer, then a score at the end.
Ready? Notes and flashcards are locked until you finish the quiz.