Intuition Why this page exists
The parent note built the two tools: prime factorization and the Euclidean algorithm . But tools break at the edges — what if one number is 0 ? What if one divides the other cleanly? What about negative numbers? A word problem? Below we first list every kind of input the topic can throw at you (the "scenario matrix"), then work one full example per row so you never meet an untested case.
Throughout, remember the two chants from the parent:
"HCF = Humble" — take the smaller (min) prime powers.
"Divide, remainder, repeat — last non-zero is the treat."
Each row is one class of input. The last column names the example that covers it.
#
Case class
What's special / where beginners trip
Covered by
A
Ordinary two positives
baseline — both methods must agree
Ex 1
B
One divides the other
the smaller number is the answer
Ex 2
C
Coprime pair (g cd= 1 )
no shared primes — answer is 1 , not 0
Ex 3
D
A zero input (g cd( a , 0 ) )
convention g cd( a , 0 ) = a ; Euclid stops instantly
Ex 4
E
Negative number(s)
sign is irrelevant — divisors ignore sign
Ex 5
F
Both methods, big numbers
factoring is painful → Euclid wins
Ex 6
G
Three or more numbers
chain the pairwise gcd
Ex 7
H
Word problem (tiles / bags)
translate "largest equal group" → gcd
Ex 8
I
Exam twist: gcd·lcm identity
find lcm without listing multiples
Ex 9
Recall Two degenerate edges worth naming now
What is g cd( 0 , 0 ) ? ::: Undefined / conventionally 0 — every integer divides 0 , so there is no largest common divisor. Never appears in exams as a valid answer.
What is g cd( a , a ) ? ::: a itself (for a > 0 ) — a number's largest divisor is itself, and it divides both copies.
g cd( 84 , 120 ) two ways
Forecast first: both even, both divisible by 12 ? Guess... then read on.
Method 1 — prime factorization.
Factor 84 = 2 2 ⋅ 3 ⋅ 7 .
Why this step? The Fundamental Theorem of Arithmetic says this factorization is unique, so it is a fixed "fingerprint" we can compare.
Factor 120 = 2 3 ⋅ 3 ⋅ 5 .
Why? We need the fingerprint of the second number to see which primes are shared .
Take each shared prime to the minimum exponent.
Why the minimum? The gcd must divide both , so it cannot use a prime to a higher power than either number owns → the smaller exponent is the ceiling.
prime 2 : min ( 2 , 3 ) = 2
prime 3 : min ( 1 , 1 ) = 1
prime 5 : only in 120 → exponent min ( 1 , 0 ) = 0 → dropped
prime 7 : only in 84 → dropped
g cd= 2 2 ⋅ 3 = 12 .
Method 2 — Euclid (must agree).
120 = 84 ⋅ 1 + 36 , 84 = 36 ⋅ 2 + 12 , 36 = 12 ⋅ 3 + 0.
Last non-zero remainder = 12 . ✅
Verify: 84/12 = 7 and 120/12 = 10 , both whole. And g cd( 7 , 10 ) = 1 (coprime), confirming we squeezed out everything — nothing larger than 12 can divide both. Forecast of 12 was right.
g cd( 9 , 45 )
Forecast: 45 = 9 ⋅ 5 , so 9 fits perfectly into 45 . What's the biggest number dividing both? Guess before reading.
Notice 9 ∣ 45 exactly (45 = 9 ⋅ 5 , remainder 0 ).
Why check this? If the smaller number divides the larger, the smaller number is the gcd — it divides itself and it divides the bigger one, and nothing bigger than 9 can divide 9 .
Euclid confirms in one line: 45 = 9 ⋅ 5 + 0 . Remainder is already 0 , so the divisor 9 is the answer.
Why so fast? Euclid replaces the pair by ( b , r ) = ( 9 , 0 ) and g cd( 9 , 0 ) = 9 by convention.
g cd( 9 , 45 ) = 9 .
Verify: 9/9 = 1 , 45/9 = 5 , both whole. Largest divisor of 9 is 9 itself, so nothing bigger works. ✅ Forecast 9 correct.
g cd( 35 , 24 )
Forecast: 35 = 5 ⋅ 7 , 24 = 2 3 ⋅ 3 . Do they share a prime? Guess the answer.
Factor 35 = 5 ⋅ 7 and 24 = 2 3 ⋅ 3 .
Why? Comparing fingerprints instantly shows whether any prime is common.
No prime appears in both lists.
Why does that give 1 , not 0 ? The number 1 divides every integer (it uses zero primes), so it is always a common divisor. When no prime is shared, 1 is the largest common divisor. Zero would mean "nothing divides both", which is false.
g cd= 1 . Such numbers are called coprime (relatively prime).
Euclid cross-check: 35 = 24 ⋅ 1 + 11 ; 24 = 11 ⋅ 2 + 2 ; 11 = 2 ⋅ 5 + 1 ; 2 = 1 ⋅ 2 + 0 . Last non-zero remainder = 1 . ✅
Verify: g cd= 1 means the fraction 24 35 is already in lowest terms — nothing cancels. Forecast 1 correct.
g cd( 17 , 0 )
Forecast: does 0 "have no divisors" (answer 0 ?) or does everything divide 0 (answer 17 ?). Decide, then read.
Recall the convention: g cd( a , 0 ) = a .
Why? Every integer d satisfies 0 = d ⋅ 0 , so every integer divides 0 . The common divisors of ( 17 , 0 ) are therefore exactly the divisors of 17 . The largest divisor of 17 is 17 itself.
Euclid stops immediately: with b = 0 there is no division to do; the current a = 17 is the answer.
Why? This is precisely the stopping rule — remainder already 0 , so the last non-zero value (17 ) is returned.
g cd( 17 , 0 ) = 17 .
Verify: 17 ∣ 17 ✓ and 17 ∣ 0 ✓ (since 0 = 17 ⋅ 0 ). Nothing bigger than 17 divides 17 , so 17 is maximal. Forecast "17 " correct.
g cd( − 48 , 36 )
Forecast: does the minus sign make the answer negative, or does it vanish? Guess.
Replace each number by its absolute value : g cd( − 48 , 36 ) = g cd( 48 , 36 ) .
Why is this legal? "d divides n " means n = d ⋅ k for an integer k ; if it holds for n it holds for − n (just flip k 's sign). So the set of divisors of − 48 equals the set for 48 . Sign carries no divisibility information. By convention the gcd is taken positive .
Now Euclid on positives: 48 = 36 ⋅ 1 + 12 ; 36 = 12 ⋅ 3 + 0 . Answer 12 .
g cd( − 48 , 36 ) = 12 (positive).
Verify: − 48/12 = − 4 (whole), 36/12 = 3 (whole). Both divide evenly; the answer is the positive 12 . Forecast (if you said 12 ) correct.
The figure below shows why Euclid is the power tool: each step chops the pair down like a staircase, while factoring a large number is a search for hidden primes.
g cd( 2244 , 418 )
Forecast: both even; is the answer 2 ? something bigger? Guess.
Euclid (fast lane):
2244 = 418 ⋅ 5 + 154 .
Why? 418 ⋅ 5 = 2090 , and 2244 − 2090 = 154 . We replace the big number by the leftover — the parent's lemma g cd( 2244 , 418 ) = g cd( 418 , 154 ) keeps the answer unchanged.
418 = 154 ⋅ 2 + 110 . ( 154 ⋅ 2 = 308 , 418 − 308 = 110 )
154 = 110 ⋅ 1 + 44 .
110 = 44 ⋅ 2 + 22 .
44 = 22 ⋅ 2 + 0 → stop . Last non-zero remainder = 22 .
Why stop here? Remainder hit 0 ; the divisor of that step (22 ) is the treasure.
g cd= 22 .
Factoring cross-check (the slow lane, to trust the answer):
2244 = 2 2 ⋅ 3 ⋅ 11 ⋅ 17 , and 418 = 2 ⋅ 11 ⋅ 19 .
Shared primes: 2 (min exponent 1 ) and 11 (min exponent 1 ) → 2 ⋅ 11 = 22 . ✅
Verify: 2244/22 = 102 , 418/22 = 19 , both whole, and g cd( 102 , 19 ) = 1 . Answer confirmed at 22 .
g cd( 72 , 120 , 156 )
Forecast: all divisible by 12 ? by 24 ? Guess.
Use the chaining rule : g cd( a , b , c ) = g cd( g cd( a , b ) , c ) .
Why does chaining work? A number divides all three iff it divides the first two (that's g cd( a , b ) ) and the third. So intersecting divisor-sets two at a time loses nothing.
First pair: 120 = 72 ⋅ 1 + 48 ; 72 = 48 ⋅ 1 + 24 ; 48 = 24 ⋅ 2 + 0 → g cd( 72 , 120 ) = 24 .
Now fold in 156 : g cd( 24 , 156 ) . 156 = 24 ⋅ 6 + 12 ; 24 = 12 ⋅ 2 + 0 → 12 .
Why fold the running gcd instead of restarting? It reuses the shrunk number 24 ; the third factor can only reduce it further, never enlarge it.
g cd( 72 , 120 , 156 ) = 12 .
Verify: 72/12 = 6 , 120/12 = 10 , 156/12 = 13 — all whole. And g cd( 6 , 10 , 13 ) = 1 , so nothing bigger survives. Forecast 12 (not 24 ) is the truth — 156 knocked it down.
The figure shows the physical picture: the gcd is the largest square tile that paves a rectangle exactly.
Worked example A hall floor is
2040 cm × 1512 cm . What is the side of the largest square tile that covers it with no cutting , and how many tiles are needed?
Forecast: the tile side must divide both dimensions. Biggest such number = ? Guess whether it's more or less than 100 cm.
Translate: "largest side dividing both 2040 and 1512 " = g cd( 2040 , 1512 ) .
Why gcd? A whole tile with side s fits along a wall of length L iff s ∣ L . Fitting both walls needs s dividing both; largest such s is the gcd.
Euclid: 2040 = 1512 ⋅ 1 + 528 .
1512 = 528 ⋅ 2 + 456 .
528 = 456 ⋅ 1 + 72 .
456 = 72 ⋅ 6 + 24 .
72 = 24 ⋅ 3 + 0 → stop . Tile side = 24 cm.
Number of tiles = 24 2040 × 24 1512 = 85 × 63 = 5355 .
Why multiply the two counts? 85 tiles fit along the length, 63 across the width; a rectangular grid holds length × width tiles.
Verify: 24 ∣ 2040 (2040/24 = 85 ✓), 24 ∣ 1512 (1512/24 = 63 ✓). Units: cm ÷ cm = pure count, good. Total tile area 5355 × 2 4 2 = 3 , 084 , 480 cm 2 , and 2040 × 1512 = 3 , 084 , 480 cm 2 — floor fully covered, no gaps. ✅
g cd( a , b ) = 18 and lcm ( a , b ) = 1080 with a = 90 , find b .
Forecast: will b be bigger or smaller than 90 ? Guess.
Use the identity g cd( a , b ) ⋅ lcm ( a , b ) = a ⋅ b (proved in the parent from min + max = α + β ; see LCM — Least Common Multiple ).
Why this identity and not raw factoring? We are given the gcd and lcm, so the identity lets us solve for the unknown directly — no need to factor anything.
Plug in: 18 ⋅ 1080 = 90 ⋅ b , so 19440 = 90 b .
Solve: b = 19440/90 = 216 .
Why is this valid? The identity is an exact equality of integers, so dividing both sides by 90 (which divides 19440 ) gives the unique b .
b = 216 .
Verify: Factor to double-check: 90 = 2 ⋅ 3 2 ⋅ 5 , 216 = 2 3 ⋅ 3 3 .
g cd= 2 m i n ( 1 , 3 ) 3 m i n ( 2 , 3 ) 5 m i n ( 1 , 0 ) = 2 ⋅ 9 = 18 ✓.
lcm = 2 m a x ( 1 , 3 ) 3 m a x ( 2 , 3 ) 5 m a x ( 1 , 0 ) = 8 ⋅ 27 ⋅ 5 = 1080 ✓.
Both match — b = 216 , larger than 90 . Forecast check!
Recall Self-test: name the covered case for each answer
g cd( 84 , 120 ) = ? ::: 12 (Case A, ordinary positives)
g cd( 9 , 45 ) = ? ::: 9 (Case B, one divides the other)
g cd( 35 , 24 ) = ? ::: 1 (Case C, coprime)
g cd( 17 , 0 ) = ? ::: 17 (Case D, zero input)
g cd( − 48 , 36 ) = ? ::: 12 (Case E, negatives → use absolute value)
g cd( 2244 , 418 ) = ? ::: 22 (Case F, big numbers by Euclid)
g cd( 72 , 120 , 156 ) = ? ::: 12 (Case G, three numbers chained)
Largest tile for 2040 × 1512 ? ::: side 24 cm, 5355 tiles (Case H, word problem)
If g cd= 18 , lcm = 1080 , a = 90 then b = ? ::: 216 (Case I, identity twist)
Mnemonic The one-line safety net
Every gcd answer must divide both inputs , and after dividing, the two quotients must be coprime (their own gcd is 1 ). If not, you left a common factor on the table.