Module 3.3 · Number Theory
GCD and LCM
Two buses leave the station together, one every minutes and one every . When do they leave together again? A rectangle must be cut into the largest possible equal squares. How big are the squares? The first question asks for a least common multiple and the second for a greatest common divisor. Contest writers disguise these two ideas in many costumes.
Definitions
Definition
GCD and LCM
The greatest common divisor is the largest whole number that divides both and . (MATHCOUNTS often calls it the greatest common factor, GCF.)
The least common multiple is the smallest positive whole number that is a multiple of both and .
Using prime factorizations
Write both numbers as products of primes.
- For the GCD, take each common prime to the smaller power.
- For the LCM, take every prime that appears to the larger power.
Worked example: Factorization method
Find and .
and .
- GCD: smaller powers of the common primes and : .
- LCM: larger power of every prime: .
Notice that . That's not a coincidence. For each prime, the GCD takes one of the two exponents and the LCM takes the other, so together they use every prime factor of and exactly once.
The product rule
For any two positive integers,
Common mistake
The product rule works for two numbers only. For three numbers, is usually not . For example, , but .
The Euclidean algorithm
Factoring large numbers is slow. Luckily, any number that divides both and also divides . So , and you can subtract (or take remainders) repeatedly until the numbers are small.
Worked example: Euclidean algorithm
Find .
Indeed, and .
Spotting GCD vs. LCM in word problems
- "Together again," "at the same time," "repeating cycles" point to the LCM.
- "Largest equal groups," "biggest square tiles," "cut into equal pieces with none left over" point to the GCD.
Worked example: Pairs with a given GCD and LCM
How many ordered pairs of positive integers have and ?
Write and where and share no common factor. Then , so . Since and share no prime, the whole goes to one of them and the goes to one of them. The choices are .
That gives 4 ordered pairs: .
Tip
The trick of writing , with turns almost every "given the GCD and LCM" problem into a counting problem about and .
Practice
What is the greatest common divisor of and ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is the least common multiple of , and ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Three lights flash every , and seconds. They all flash together at exactly noon. When is the next time they all flash together?
The GCD of two numbers is and their LCM is . One of the numbers is . What is the other?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Use the Euclidean algorithm to find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
An cm by cm sheet of paper is cut into identical squares, as large as possible, with no paper left over. How many squares are there?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
How many pairs of positive integers with have and ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is the smallest positive integer that leaves a remainder of when divided by each of and , and is divisible by ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Real contest practice
- 2013 AMC 8, Problem 10: the ratio of an LCM to a GCF.
- 2018 AMC 8, Problem 21: three remainder conditions combined into one LCM.