0Pricing
Competitive Programming Academy · Lesson

GCD, LCM & the Euclidean Algorithm

Compute divisors fast and correctly.

Why Divisors Matter

So many contest problems hinge on shared factors of two numbers. The single most useful tool here is the GCD, the greatest common divisor. 🔢

What GCD Means

The GCD of two integers is the largest number that divides both with no remainder. For 12 and 18 it is 6, since 6 splits both evenly.

All lessons in this course

  1. GCD, LCM & the Euclidean Algorithm
  2. Primality Testing up to sqrt(n)
  3. Sieve of Eratosthenes
  4. Prime Factorization & Divisors
← Back to Competitive Programming Academy