1.1.10 · D3Arithmetic & Number Systems

Worked examples — HCF (GCD) — prime factorization method, Euclidean algorithm

2,400 words11 min readBack to topic

The scenario matrix

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 () no shared primes — answer is , not Ex 3
D A zero input () convention ; 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 ? ::: Undefined / conventionally every integer divides , so there is no largest common divisor. Never appears in exams as a valid answer. What is ? ::: itself (for ) — a number's largest divisor is itself, and it divides both copies.


Ex 1 — Case A: ordinary two positives


Ex 2 — Case B: one number divides the other


Ex 3 — Case C: coprime pair (answer is 1, not 0)


Ex 4 — Case D: a zero input


Ex 5 — Case E: negative numbers


Ex 6 — Case F: big numbers, factoring vs Euclid

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.

Figure — HCF (GCD) — prime factorization method, Euclidean algorithm

Ex 7 — Case G: three numbers


Ex 8 — Case H: word problem (tiles / bags)

The figure shows the physical picture: the gcd is the largest square tile that paves a rectangle exactly.

Figure — HCF (GCD) — prime factorization method, Euclidean algorithm

Ex 9 — Case I: exam twist using


Recap — did we cover every cell?

Recall Self-test: name the covered case for each answer

::: (Case A, ordinary positives) ::: (Case B, one divides the other) ::: (Case C, coprime) ::: (Case D, zero input) ::: (Case E, negatives → use absolute value) ::: (Case F, big numbers by Euclid) ::: (Case G, three numbers chained) Largest tile for ? ::: side cm, tiles (Case H, word problem) If , , then ::: (Case I, identity twist)

Connections