All courses › Discrete Mathematics › Greatest common divisor
Greatest common divisor
The greatest common divisor is the largest number that divides two integers. Euclid's algorithm finds it quickly by dividing repeatedly and replacing the numbers with the remainder until the remainder is zero. The last non-zero remainder is the answer.
Euclid's algorithm
least common multiple
Symbols
| greatest common divisor | ||
| least common multiple |
Example
: and .
The answer is 12.
The algorithm is fast even for large numbers, because the numbers at least halve every other round.
Practise graphs and modular arithmetic for free →
Part of Discrete Mathematics: Graphs and modular arithmetic.