TR

Home / Guides / How to Find GCD and LCM: Prime Factors, the Euclidean Method and Solved Problems

How to Find GCD and LCM: Prime Factors, the Euclidean Method and Solved Problems

Updated: November 6, 2026 · AracMerkezi

▶ Open GCD / LCM Calculator

GCD and LCM are two basic concepts we meet from primary school on. They are used to simplify fractions, equalize denominators, and solve problems of the "when do they meet again" or "what is the longest piece in cm" type. This guide does not stop at repeating the two methods (prime factorization and the Euclidean algorithm); it shows which method is easier when, the trap to watch for with three numbers, and how to decide "GCD or LCM?" from the wording of a question. All results were calculated with Python and also checked by hand.

Definitions

A quick reminder: the GCD cannot be larger than the numbers, and the LCM cannot be smaller than the numbers. With these two rules you can immediately sanity-check a result.

Method 1: Prime factorization

Let's look at 180 and 252:

GCD: Multiply the common prime factors with their smallest exponents: 2² × 3² = 36.

LCM: Multiply all prime factors with their largest exponents: 2² × 3² × 5 × 7 = 1,260.

Check: 180 / 36 = 5 and 252 / 36 = 7; both divide evenly and 5 and 7 have no common divisor. 1,260 / 180 = 7 and 1,260 / 252 = 5; so 1,260 is a multiple of both.

Method 2: The Euclidean algorithm (for the GCD)

You divide the larger number by the smaller and take the remainder; you keep dividing the divisor by the remainder until the remainder is zero. The last divisor is the GCD. As numbers get larger, prime factorization gets harder, while Euclid finishes in a few steps. For 1,071 and 462:

  1. 1,071 = 2 × 462 + 147
  2. 462 = 3 × 147 + 21
  3. 147 = 7 × 21 + 0

The last divisor is 21, so GCD = 21. You find the LCM from the relationship: 1,071 × 462 / 21 = 23,562.

The relationship between GCD and LCM

For two numbers, the equality GCD × LCM = a × b holds. If the GCD is known, LCM = a × b / GCD. For 48 and 18 the GCD is 6 and the LCM is 48 × 18 / 6 = 144. Note: this relationship holds only for two numbers (see the trap below).

GCD and LCM of three numbers

For 12, 18 and 30 the factors are: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. GCD = 2 × 3 = 6, LCM = 2² × 3² × 5 = 180. For these three numbers the rule "GCD × LCM = product" does not work: 12 × 18 × 30 = 6,480, yet 6 × 180 = 1,080. For three or more numbers, find the LCM with the factors or by combining two at a time, not with the relationship.

Solved examples

NumbersGCDLCM
24 and 361272
15 and 20560
7 and 9 (coprime)163
100 and 7525300

How is it used in problems?

Look for these cues in the wording: phrases such as "largest", "divide into equal pieces", "no leftover" point to the GCD; phrases such as "when again", "at least how many", "at the same time" point to the LCM.

Problem 1 (GCD): Square tiles are to be laid on a 360 cm × 240 cm floor without cutting. The largest tile side is GCD(360, 240) = 120 cm. The number of tiles is (360 / 120) × (240 / 120) = 3 × 2 = 6.

Problem 2 (LCM): Three buses leave the terminal every 4, 6 and 10 minutes respectively. For them to leave together again after leaving together, LCM(4, 6, 10) = 60 minutes is needed.

Problem 3 (two ropes): To cut ropes of 24 m and 36 m into equal pieces with no leftover, the GCD is 12; the longest piece is 12 m. Duty rota: for two people who take a turn every 6 days and every 8 days, the LCM is 24, so they land on the same day 24 days later.

Problem 4 (three bells): Three bells ring every 60, 90 and 150 seconds respectively and have just rung together. For them to ring together again, LCM(60, 90, 150) = 900 seconds is needed; that is 900 / 60 = 15 minutes. Note that you first kept the seconds in the same unit; if units get mixed, the LCM loses its meaning. In time problems, converting the result to minutes or hours at the very end is the safest way.

Problem 5 (forming groups): 48 boys and 36 girls will be divided into groups so that each group has the same number of boys and the same number of girls and nobody is left out. The maximum number of groups is GCD(48, 36) = 12; each group has 4 boys and 3 girls. The phrase "maximum groups" points to the GCD, and "equal distribution in each group" points to divisibility.

Use with fractions

For more fraction examples see the guides Simplifying Fractions: GCD and Mixed Number Examples and How to Do Fraction Operations.

Common mistakes

Mini glossary

The GCD / LCM Calculator shows both for two positive integers. To see prime factors use the Prime Number Check and Prime Factorization tool, and for proportion questions the guide How to Calculate Ratio and Proportion.

Frequently asked questions

What is the relationship between GCD and LCM?

The product of two numbers equals the GCD times the LCM: a × b = GCD × LCM. This relationship does not hold for three or more numbers.

What is the GCD of coprime numbers?

It is 1; their LCM is the product of the two numbers. For example, for 7 and 9 the GCD is 1 and the LCM is 63.

Which method finds the GCD most easily?

Prime factorization is practical for small numbers and the Euclidean algorithm for large ones. For 1,071 and 462, Euclid gives 21 in three steps.

Tools mentioned in this guide

More guides

Important note: Results are estimates based on published coefficients and guides and do not replace official results. For exact information, rely on announcements from ÖSYM, MEB, YÖK or your school.

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.