Number Theory / Divisibility
GCD and the Euclidean Algorithm
The fastest ancient algorithm still in daily use, and Bézout’s identity, which it proves for free.
Contents 3 sections
By the end you can
- Compute greatest common divisors with the Euclidean algorithm
- Run the extended algorithm to find Bézout coefficients
- Solve linear Diophantine equations
Helps to know: Primes and Divisibility
§1Remainders all the way down
The key fact: , because anything dividing and also divides the remainder. Repeat until the remainder is zero.
Example 1
§2Bézout’s identity
Consequently has integer solutions exactly when . With jugs holding 4 and 6 litres you can measure only even amounts; with 4 and 7 you can measure any whole number.
Check yourself
- Q1
- Q2Does have integer solutions?