Skip to main content
Online

GCD and LCM practice

Greatest common divisor and least common multiple of two numbers. Work through one problem at a time and get a new one on every click, or print a worksheet with an answer key.

Easy: Small numbers. Medium: Two-digit numbers. Hard: Larger numbers.

Loading your first problem…

How to solve gcd and lcm problems

  1. Euclid's algorithm: divide the larger number by the smaller and keep the remainder.
  2. Repeat with the smaller number and the remainder until the remainder is 0.
  3. The last non-zero remainder is the GCD.
  4. LCM(a, b) = a × b ÷ GCD(a, b).

Worked example

Find the GCD and LCM of 84 and 36.

  1. 84 = 2 × 36 + 12.
  2. 36 = 3 × 12 + 0, so the GCD is 12.
  3. LCM = 84 × 36 ÷ 12 = 252.

Answer: GCD = 12, LCM = 252

Common mistakes

  • Using a × b as the LCM without dividing by the GCD.
  • Stopping Euclid's algorithm one step too early.

How to use this page

  • Students: work each problem on paper, type your answer and press Check. Use Hint if you are stuck and open the worked solution only after you have tried. Three right answers in a row move you up a level.
  • Teachers: use Copy link to this problem to share a single question, or switch to Printable worksheet, press New worksheet until you like the set, and share its link. Everyone who opens it gets the same problems.
  • The full method for this topic is explained in the gcd and lcm solver, which also solves your own problems step by step.
  • More topics: all practice topics, or mix every topic in one session on the practice page.