Page 1 of 9 · Overview

Lesson 2 of 8 · Number Theory

GCD, LCM & the Euclidean Algorithm

Factoring two numbers to find their gcd works, but it's slow for large numbers. The Euclidean algorithm finds the gcd of any two integers in a handful of steps, no matter how large — and it's the foundation for Bezout's identity, which shows up again later in this domain.

Mark your status for this lesson:

Learning objectives

  • Compute gcd(a, b) efficiently using the Euclidean algorithm, for numbers too large to factor comfortably by hand.
  • Use the relationship gcd(a,b) × lcm(a,b) = a × b to find one quantity from the other.
  • Find the gcd or lcm of three or more numbers by combining results pairwise.
  • Recognize Bezout's identity — gcd(a,b) as a linear combination of a and b — and use it in simple modular-inverse problems.