Euclid’s algorithm
is the largest integer dividing both and .
If , then . Repeat until the remainder is . The last non-zero remainder is the gcd.
- 01Divide
- 02Divide
- 03Remainder
- 04The last non-zero remainder is , so .Conclusion
is the largest integer dividing both and .
If , then . Repeat until the remainder is . The last non-zero remainder is the gcd.