GCD / LCM
Greatest common divisor and least common multiple — tools for divisibility, cycles, and scheduling problems on the AMC10.
Overview
The greatest common divisor (GCD) of two positive integers and is the largest integer that divides both. The least common multiple (LCM) is the smallest positive integer that both and divide. Together, GCD and LCM control when two repeating processes first "line up," how to simplify fractions, and whether a system of equations has integer solutions.
AMC10 problems love GCD/LCM because a single elegant identity connects them: for any two positive integers and , This means you can find one if you know the other, without ever factoring. Many problems are solved in two lines using this identity alone.
The Euclidean algorithm makes GCD computation fast and elegant — no prime factorization required. For larger or more structural problems (like "how many integers below are coprime to ?"), prime factorizations and Euler's totient function take over. Knowing which tool fits which situation is the core skill here.
Key facts
- Euclidean algorithm: , repeating until the remainder is . The last nonzero remainder is the GCD. Fast, no factoring needed.
- GCD via prime factorization: write and ; then — take the minimum exponent for each prime.
- LCM via prime factorization: — take the maximum exponent for each prime.
- Product identity: — the single most-used identity. Works for two integers only (not three or more).
- Relatively prime (coprime): and are relatively prime when . Their LCM equals their product: .
- Euler's totient: counts integers from to coprime to . For : .
- Cycle / gear problems: two events with periods and first coincide after time units — find LCM, then divide by the period of whichever quantity the question asks about.
Worked example 1
Find using the Euclidean algorithm, then find .
Apply the algorithm step by step:
(Each step: ; ; .)
Now use the product identity:
Quick check via factorization: and . GCD ✓; LCM ✓.
Worked example 2
Three lights flash at a traffic intersection. Light A flashes every 8 seconds, Light B every 12 seconds, and Light C every 20 seconds. They all flash together at time . After how many seconds do they next all flash together? How many times does Light A flash in that interval (not counting )?
Step 1 — find LCM(8, 12, 20).
Factorize: , , .
The lights next coincide at seconds.
Step 2 — count flashes of Light A.
Light A flashes at . That's flashes (not counting ).
Common traps
- Using the product formula for three or more numbers. The identity holds for exactly two integers. For three integers, compute pairwise: .
- Min vs. max for GCD/LCM. GCD uses min exponents (the overlap), LCM uses max exponents (the union). Swapping them is the single most common error in factorization problems.
- Forgetting that gcd(a, b) divides both a and b. If the problem says , write , with . This parametrization unlocks many otherwise hard problems.
- Counting rotations vs. teeth in gear problems. When two gears mesh, the number of teeth that pass the contact point is the same for both. The first alignment repeats after teeth, which equals full rotations of Gear A.
- Confusing "relatively prime to " with "prime." The integers and are relatively prime () even though neither is prime. On the other hand, and are not relatively prime even though is not a multiple of .