Core answer: GCD (greatest common divisor) of 12 and 18 is 6; LCM (least common multiple) is 36. They obey one identity: GCD × LCM = product of the two numbers (6 × 36 = 216 = 12 × 18). Find the GCD fast with Euclid's algorithm — divide and take remainders: gcd(48, 18) = gcd(18, 12) = gcd(12, 6) = 6.
Euclid's algorithm (2,300 years old, still unbeaten)
Repeatedly replace (a, b) with (b, a mod b) until the remainder is 0:
gcd(252, 105): 252 = 2×105 + 42 → 105 = 2×42 + 21 → 42 = 2×21 + 0 → GCD = 21.
It never takes more than ~5 × (number of digits) steps — logarithmic, which is why it powers crypto key generation.
Prime-factorization method (good by hand)
| 12 | 18 | |
|---|---|---|
| Factorization | 2² × 3 | 2 × 3² |
| GCD (min powers) | 2¹ × 3¹ = 6 | |
| LCM (max powers) | 2² × 3² = 36 |
GCD takes the *smaller* exponent of each shared prime; LCM takes the *larger* of every prime present.
Where you actually use them
Simplifying fractions. 84/126: gcd = 42 → 2/3 in one step.
Tiling a floor. A 252 × 105 cm floor with the largest identical square tiles: side = gcd(252,105) = 21 cm → 12 × 5 = 60 tiles, zero cuts.
Repeating events. Bus A every 12 min, bus B every 18 min: they depart together every lcm(12,18) = 36 min. If 6:00 was synchronized, next joint departures are 6:36, 7:12, 7:48.
Gear ratios. Meshing gears with 12 and 18 teeth realign after lcm(12,18) = 36 tooth-passes = 3 revolutions of the small gear, 2 of the large.
Common mistakes and myths
- Confusing GCD with LCM — GCD divides both numbers (≤ both); LCM is divided by both (≥ both). For distinct primes, GCD = 1 and LCM = product.
- Thinking GCD × LCM = a × b works for 3+ numbers — the identity holds for exactly two; for more, compute pairwise.
- Assuming coprime means prime — 8 and 15 are coprime (gcd = 1) yet neither is prime.
- Listing multiples instead of using the identity — lcm(a,b) = a×b/gcd(a,b) is one division, no lists.
- Forgetting GCD in fraction answers — 2/4 and 1/2 are equal, but only the simplified form counts as fully reduced.