AMC 10 Step by Step

Topics / Number Theory

GCD & LCM

GCD/LCM computation, Euclidean algorithm, gcd*lcm = product

10
primary-topic problems (0.8% of all)
18
more as a secondary topic
Where it appears
3
P1-10
0
P11-15
2
P16-20
5
P21-25

What you need to know

  • For positive integers a,ba, b: gcd(a,b)lcm(a,b)=ab\gcd(a,b) \cdot \operatorname{lcm}(a,b) = ab. This extends to prime exponents: gcd\gcd takes the minimum exponent of each prime, lcm\operatorname{lcm} the maximum.
  • Euclidean algorithm: gcd(a,b)=gcd(b,amodb)\gcd(a, b) = \gcd(b, a \bmod b); more generally gcd(a,b)=gcd(a,bka)\gcd(a, b) = \gcd(a, b - ka) for any integer kk.
  • If gcd(a,b)=g\gcd(a, b) = g, then a=gxa = gx, b=gyb = gy with gcd(x,y)=1\gcd(x, y) = 1, and lcm(a,b)=gxy\operatorname{lcm}(a, b) = gxy.
  • gcd(a,b)=1\gcd(a, b) = 1 is called relatively prime (coprime). Consecutive integers are always coprime.
  • lcm(a1,,ak)\operatorname{lcm}(a_1, \ldots, a_k) is the smallest positive integer divisible by all aia_i; it is the period of anything that repeats with periods a1,,aka_1, \ldots, a_k.
  • The count of nNn \le N coprime to a fixed mm can be found by inclusion–exclusion over the primes of mm.

How AMC 10 tests it

  • Word problems in disguise: events with periods 3,4,6,73, 4, 6, 7 days coincide every lcm\operatorname{lcm} days; tiles or fence posts use gcd\gcd.
  • "Given gcd(a,b)\gcd(a,b) and lcm(a,b)\operatorname{lcm}(a,b), how many pairs (a,b)(a,b)?" or "what is a+ba + b?" (usually problems 12–18).
  • gcd\gcd of two large or symbolic numbers, such as gcd(2301,2181)\gcd(2^{30}-1, 2^{18}-1) or gcd(n2+1,n+1)\gcd(n^2 + 1, n + 1), meant to be simplified by the Euclidean algorithm.
  • Fractions in lowest terms: ab\frac{a}{b} reduced has denominator b/gcd(a,b)b/\gcd(a,b); count numerators with a given reduced denominator.

Standard approaches

  1. Factor both numbers and take min/max exponents; this settles any concrete gcd\gcd/lcm\operatorname{lcm} instantly.
  2. For symbolic or huge inputs, subtract multiples: gcd(n2+1,n+1)=gcd(2,n+1)\gcd(n^2+1, n+1) = \gcd(2, n+1).
  3. Substitute a=gxa = gx, b=gyb = gy with gcd(x,y)=1\gcd(x,y) = 1; the problem becomes a coprime-pair count.
  4. Use ab=gcdlcmab = \gcd \cdot \operatorname{lcm} whenever three of the four quantities are known.
  5. For coprime ordered pairs with product mm, each prime power of mm goes entirely to one side: 2ω(m)2^{\omega(m)} pairs, where ω(m)\omega(m) is the number of distinct primes.

Worked example

How many ordered pairs of positive integers (a,b)(a, b) satisfy gcd(a,b)=6\gcd(a, b) = 6 and lcm(a,b)=360\operatorname{lcm}(a, b) = 360?

(A) 44 (B) 66 (C) 88 (D) 1212 (E) 1616

Write a=6xa = 6x and b=6yb = 6y with gcd(x,y)=1\gcd(x, y) = 1. Then lcm(a,b)=6xy=360\operatorname{lcm}(a, b) = 6xy = 360, so xy=60=2235xy = 60 = 2^2 \cdot 3 \cdot 5. Because xx and yy are coprime, each prime power 222^2, 33, 55 must go entirely to xx or entirely to yy: that is 23=82^3 = 8 choices, giving the ordered pairs (x,y)=(1,60),(4,15),(3,20),(5,12)(x, y) = (1, 60), (4, 15), (3, 20), (5, 12) and their reverses. Each yields a valid (a,b)(a, b), for example (24,90)(24, 90). The answer is (C) 8\boxed{\textbf{(C)}\ 8}.

Pitfalls

  • Using gcdlcm=\gcd \cdot \operatorname{lcm} = product for three or more numbers; the identity holds only for two.
  • Forgetting the coprimality condition after factoring out gg, which overcounts pairs.
  • Confusing ordered and unordered pairs; (a,b)(a, b) and (b,a)(b, a) count separately unless stated otherwise.
  • Reducing gcd(a,b)\gcd(a, b) by subtracting the wrong direction, e.g., replacing aa with aba - b when b>ab > a and losing track of signs.

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)

Problems, easiest first

2022 AMC 10A · #7GCD & LCM

The least common multiple of a positive integer nn and 1818 is 180180 , and the greatest common divisor of nn and 4545 is 1515 . What is the sum of the digits of nn ?

2019 AMC 10B · #7GCD & LCM

Each piece of candy in a store costs a whole number of cents. Casper has exactly enough money to buy either 1212 pieces of red candy, 1414 pieces of green candy, 1515 pieces of blue candy, or nn pieces of purple candy. A piece of purple candy costs 2020 cents. What is the smallest possible value of nn ?

2001 AMC 10 · #8GCD & LCM

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 …

2025 AMC 10A · #17GCD & LCM

Let NN be the unique positive integer such that dividing 273436273436 by NN leaves a remainder of 1616 and dividing 272760272760 by NN leaves a remainder of 1515 . What is the tens digit of NN ?

2023 AMC 10B · #18GCD & LCM

Suppose aa , bb , and cc are positive integers such that a14+b15=c210.\dfrac{a}{14}+\dfrac{b}{15}=\dfrac{c}{210}. Which of the following statements are necessarily true? I. If gcd(a,14)=1\gcd(a,14)=1 or gcd(b,15)=1\gcd(b,15)=1 or both, then gcd(c,210)=1\gcd(c,210)=1 . II. If gcd(c,210)=1\gcd(c,210)=1 , then gcd(a,14)=1\gcd(a,14)=1 or gcd(b,15)=1\gcd(b,15)=1 or both. III. …

2020 AMC 10A · #24GCD & LCM

Let nn be the least positive integer greater than 10001000 for which gcd(63,n+120)=21andgcd(n+63,120)=60.\gcd(63, n+120) =21\quad \text{and} \quad \gcd(n+63, 120)=60. What is the sum of the digits of nn ?

2018 AMC 10B · #23GCD & LCM

How many ordered pairs (a,b)(a, b) of positive integers satisfy the equation ab+63=20lcm(a,b)+12gcd(a,b),a\cdot b + 63 = 20\cdot \text{lcm}(a, b) + 12\cdot\text{gcd}(a,b), where gcd(a,b)\text{gcd}(a,b) denotes the greatest common divisor of aa and bb , and lcm(a,b)\text{lcm}(a,b) denotes their least common multiple?

2018 AMC 10A · #22GCD & LCM

Let a,b,c,a, b, c, and dd be positive integers such that gcd(a,b)=24\gcd(a, b)=24 , gcd(b,c)=36\gcd(b, c)=36 , gcd(c,d)=54\gcd(c, d)=54 , and 70<gcd(d,a)<10070<\gcd(d, a)<100 . Which of the following must be a divisor of aa ?

2016 AMC 10A · #25GCD & LCM

How many ordered triples (x,y,z)(x,y,z) of positive integers satisfy lcm(x,y)=72,lcm(x,z)=600\text{lcm}(x,y) = 72, \text{lcm}(x,z) = 600 and lcm(y,z)=900\text{lcm}(y,z)=900 ?

2005 AMC 10A · #22GCD & LCM

Let SS be the set of the 20052005 smallest positive multiples of 44 , and let TT be the set of the 20052005 smallest positive multiples of 66 . How many elements are common to SS and TT ?