GCD & LCM
GCD/LCM computation, Euclidean algorithm, gcd*lcm = product
What you need to know
- gcd times lcm. The gcd (greatest common divisor) is the biggest number dividing both and ; the lcm (least common multiple) is the smallest positive number both divide. For positive integers, .
- With prime factorizations, the gcd takes the smaller exponent of each prime and the lcm takes the larger. Example: and have gcd and lcm , and .
- Euclidean Algorithm. , where is the remainder when is divided by . Repeat until the remainder is . Example: .
- Subtracting multiples. More generally, for any integer , because a number that divides and also divides , and the other way round. Example: .
- Pulling out the gcd. If , write and . Then and share no factor except , and . Example: and , so the lcm is .
- Relatively prime (or coprime) means the gcd is . Consecutive integers are always relatively prime, since a common divisor would also divide their difference, .
- Things that repeat. is the smallest positive number that all of divide. So things that repeat every , …, days all line up again every lcm days. Example: buses every , , and minutes leave together every minutes.
- Counting numbers relatively prime to . For the numbers from to , use the Principle of Inclusion-Exclusion (PIE) on the primes of . Example: from to : .
How AMC 10 tests it
- Word problems in disguise: events with periods of , , , days line up every lcm days; tiles or fence posts use the gcd.
- "Given and , how many pairs ?" or "what is ?" (usually problems 12–18).
- The gcd of huge numbers or expressions, such as or , meant to be simplified with the Euclidean Algorithm.
- Fractions in lowest terms: reduces to denominator ; count the numerators that give a certain reduced denominator.
Standard approaches
- Factor both numbers and take the smaller or larger exponent of each prime. This settles any gcd or lcm of actual numbers.
- For expressions or huge numbers, subtract multiples. Example: , so : if is odd, if is even. Likewise , and continuing gives .
- Write and with ; the problem becomes counting relatively prime pairs.
- Use whenever three of the four are known. Example: if and , then .
- For ordered pairs of relatively prime numbers with product , each prime power of goes entirely to one side. If has different prime factors, that gives pairs. Example: gives pairs: , , , .
Worked example
How many ordered pairs of positive integers satisfy and ?
(A) (B) (C) (D) (E)
Step 1: pull out the gcd. Write and . Then and share no factor except ; otherwise the gcd would be bigger than .
Step 2: use the lcm. , so .
Step 3: split the primes. Since and share no factor, each of , , and goes entirely to or entirely to . (If each got one , both would be even.) That is choices: , , , , and these four reversed.
Step 4: check one. gives , with gcd and lcm .
The answer is .
Pitfalls
- Using "gcd lcm product" for three or more numbers; it holds only for two. Example: for , , , gcd lcm , but the product is .
- Forgetting that and must share no factor after you pull out , which overcounts. Example: above, gives , whose gcd is , not .
- Mixing up ordered and unordered pairs; and count separately unless the problem says otherwise.
- Subtracting the wrong way in the Euclidean Algorithm, such as replacing with when is bigger, and losing track of minus signs. Subtract the smaller from the larger.
Traps that recur
- Accepting statement I by analogy with II without testing it; a = 1, b = 3 gives c = 57, which is divisible by 3. (2023 AMC 10B #18)
- Stopping at the first n > 1000 satisfying the divisibility parts (n = 1077, digit sum 15) without checking that the gcds are exactly 21 and 60. (2020 AMC 10A #24)
- Assuming gcd(d,a) is just some multiple of 6 and picking 72, 84, 90 or 96, which would force extra factors of 2 or 3 that contradict the given gcds. (2018 AMC 10A #22)
- Forgetting that x and y must be coprime, so that xy = 9 wrongly admits (3,3) (which has gcd 63, not 21) and yields 3 ordered pairs instead of 2. (2018 AMC 10B #23)
- 1.2022 AMC 10A #7
The least common multiple of a positive integer and is , and the greatest common divisor of and is . What is the sum of the digits of ?
- A)
- B)
- C)
- D)
- E)
- 2.2019 AMC 10B #7
Each piece of candy in a store costs a whole number of cents. Casper has exactly enough money to buy either pieces of red candy, pieces of green candy, pieces of blue candy, or pieces of purple candy. A piece of purple candy costs cents. What is the smallest possible value of ?
- A)
- B)
- C)
- D)
- E)
- 3.2001 AMC 10 #8
Wanda, Darren, Beatrice, and Chi are tutors in the school math lab. Their schedule is as follows: Darren works every third school day, Wanda works every fourth school day, Beatrice works every sixth school day, and Chi works every seventh school day. Today they are all working in the math lab. In how many school days from today will they next be together tutoring in the lab?
- A)
- B)
- C)
- D)
- E)
- 4.2025 AMC 10A #17
Let be the unique positive integer such that dividing by leaves a remainder of and dividing by leaves a remainder of . What is the tens digit of ?
- A)
- B)
- C)
- D)
- E)
- 5.2023 AMC 10B #18
Suppose , , and are positive integers such that
Which of the following statements are necessarily true?
I. If or or both, then .
II. If , then or or both.
III. if and only if .
- A)
- B)
- C)
- D)
- E)
- 6.2020 AMC 10A #24
Let be the least positive integer greater than for which What is the sum of the digits of ?
- A)
- B)
- C)
- D)
- E)
- 7.2018 AMC 10B #23
How many ordered pairs of positive integers satisfy the equation where denotes the greatest common divisor of and , and denotes their least common multiple?
- A)
- B)
- C)
- D)
- E)
- 8.2018 AMC 10A #22
Let and be positive integers such that , , , and . Which of the following must be a divisor of ?
- A)
- B)
- C)
- D)
- E)
- 9.2016 AMC 10A #25
How many ordered triples of positive integers satisfy and ?
- A)
- B)
- C)
- D)
- E)
- 10.2005 AMC 10A #22
Let be the set of the smallest positive multiples of , and let be the set of the smallest positive multiples of . How many elements are common to and ?
- A)
- B)
- C)
- D)
- E)
Answers
| # | Answer | The idea it turns on |
|---|---|---|
| 1 | B | Break every number into primes. The lcm condition says n has two 2s and one 5; the gcd condition says n has exactly one 3. |
| 2 | B | Casper's money can be split evenly into 12, 14 or 15 equal prices, so it is a common multiple of those numbers. The smallest is 420 cents. |
| 3 | B | The four tutors are all together again on the first day that is a multiple of 3, 4, 6 and 7 at once. That is their least common multiple, 84. |
| 4 | E | Take away the remainders: N divides both 273420 and 272745, so it divides 45, their greatest common factor. A remainder of 16 forces N above 16, so N = 45. |
| 5 | E | Multiply by 210 to get c = 15a + 14b. Then 2 and 7 divide c exactly when they divide a, and 3 and 5 exactly when they divide b. |
| 6 | C | Each gcd says a number divides and a bigger power does not. The dividing parts give n = 237 plus multiples of 420; test 1077, 1497, 1917. |
| 7 | B | Write a = gx and b = gy, with g the gcd and x, y sharing no factor. Then 63 equals g times a whole number, so g divides 63. |
| 8 | D | Follow the 2s and 3s along the chain. The gcd of d and a has exactly one 2 and one 3, which forces it to be 78. |
| 9 | A | The lcm takes the larger power of each prime, so treat 2, 3 and 5 separately: 5, 3 and 1 choices, and 15 in all. |
| 10 | D | Common numbers are multiples of 12. S stops at 4 times 2005 = 8020, which is lower than where T stops, so count the multiples of 12 up to 8020. |
Problems © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. The topic note, tags and key insights are original to this site.