Sub topic 4
Prime factorization as the master tool
This chapter assumes you know the divisibility rules, the difference between primes and composites, and exponent notation. It also assumes basic integer division. Prime factorization turns a number into a list of prime powers. Counting factors, summing factors, HCF and LCM all become simple operations on that list.
Why factorization is the master tool
The Fundamental Theorem of Arithmetic says every integer greater than 1 can be written as a product of primes in exactly one way, apart from the order of the factors. This unique form is called the prime factorization, or canonical form:
N = p1^e1 × p2^e2 × ... × pk^ek
Here p1, p2, ..., pk are distinct primes and each exponent e is a positive integer. For example, 360 = 2^3 × 3^2 × 5.
Because the form is unique, it works like a fingerprint. Two numbers are equal only if their exponents match prime by prime. A number divides N only if its exponent for every prime is at most N's exponent for that prime. The rest of this tutorial depends on that fact.
Factorizing by hand
Two methods work well on the exam. Use whichever feels faster for the number in front of you.
Repeated division (the ladder)
Divide by the smallest prime that works, write down the quotient, and repeat until you reach 1.
- Try 2, then 3, then 5, then 7, and so on, in order.
- Each time a prime divides the current number, record the prime and divide.
- Move to the next prime only when the current one no longer divides.
- Stop when the quotient is 1.
For 360: 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45. Then 45 ÷ 3 = 15 and 15 ÷ 3 = 5. Finally 5 ÷ 5 = 1. So 360 = 2^3 × 3^2 × 5.
Factor tree
Split the number into any two factors, then split each factor, until every branch ends in a prime. The result is the same whichever split you start with.
Counting the leaves gives three 2s, two 3s and one 5, which matches the ladder.
When to stop trying primes
You never need to test primes beyond the square root of N. If N had a prime factor larger than its square root, the matching cofactor would be smaller than the square root, and you would already have found it.
To factor 391, note that 20^2 = 400, so test primes up to 19. The primes 2, 3, 5, 7, 11 and 13 all fail. Then 391 ÷ 17 = 23. So 391 = 17 × 23, and both are prime.
The same rule tests primality. If no prime up to the square root divides N, then N is prime. To check 211, note that 14^2 = 196 and 15^2 = 225, so test 2, 3, 5, 7, 11 and 13. None divides 211, so it is prime.
Reading information from the exponent form
Once you have the canonical form, many questions are answered directly.
| Question | How to answer it | For 360 = 2^3 × 3^2 × 5 |
|---|---|---|
| Is d a factor of N? | Every prime exponent in d is at most the one in N | 12 = 2^2 × 3 is a factor. 16 = 2^4 is not. |
| Is N a perfect square? | All exponents are even | No, since 3 and 1 are odd |
| Is N a perfect cube? | All exponents are multiples of 3 | No |
| Smallest multiplier to make N a perfect square | Multiply by each prime with an odd exponent | 2 × 5 = 10, giving 3600 = 60^2 |
| Smallest divisor to make N a perfect square | Divide by the same primes | 360 ÷ 10 = 36 = 6^2 |
| Number of trailing zeros | The smaller of the exponents of 2 and 5 | min(3, 1) = 1 zero |
Trailing zeros are a common trap. Each zero needs one 2 and one 5, so the count is the smaller of the two exponents. It is not the exponent of 10, because 10 does not appear in the canonical form.
Factorizing expressions, not just numbers
CAT often hides the number inside a product or a power, and you should not multiply it out. Combine the prime powers instead.
For example, find the exponent of 3 in 18^4 × 15^2. Since 18 = 2 × 3^2, we get 18^4 = 2^4 × 3^8. Since 15 = 3 × 5, we get 15^2 = 3^2 × 5^2. The product is 2^4 × 3^10 × 5^2, so the exponent of 3 is 10.
Differences of powers often factor with algebra before you reach primes. For example, 2^10 − 1 = (2^5 − 1)(2^5 + 1) = 31 × 33 = 3 × 11 × 31. A useful identity is a^2 − b^2 = (a − b)(a + b). Another is that a^n − b^n is always divisible by a − b.
Code: factorizing with a program
This program applies the same logic as the ladder. It tries each candidate divisor p while p × p ≤ n. Whatever remains above 1 at the end is a prime.
def factorize(n):
f = {}
p = 2
while p * p <= n:
while n % p == 0:
f[p] = f.get(p, 0) + 1
n //= p
p += 1
if n > 1:
f[n] = f.get(n, 0) + 1
return f
f = factorize(360)
count = 1
total = 1
for p, e in f.items():
count *= e + 1
total *= (p ** (e + 1) - 1) // (p - 1)
print(f, count, total) # {2: 3, 3: 2, 5: 1} 24 1170The if n > 1 line handles the leftover prime. For 391, the loop stops once p reaches 20, but only after dividing out 17 would n shrink. Here the loop finds 17 and leaves n = 23, which is added by the final step. The last two lines use the factorization to count and sum the factors, which later chapters explain.
Common errors
- Stopping at a composite. Writing 360 = 8 × 45 is not a factorization. Keep going until every factor is prime.
- Forgetting the exponent of 1. In 2^3 × 3^2 × 5 the prime 5 has exponent 1. Treating it as absent changes factor counts later.
- Treating 1 as prime. The number 1 is neither prime nor composite, and it never appears in a factorization.
- Skipping a prime in the ladder. Check 7 and 11 on larger numbers. Missing one gives a wrong exponent that carries through every later step.
- Multiplying out too early. Keep expressions like 12^5 × 35^2 in prime-power form. The exponents are what you need.
- Testing too many primes. Stop at the square root. For numbers under 1000, you never need a prime above 31.
Worked example
Find the smallest positive integer n such that 1800 × n is a perfect cube.
Factorize: 1800 = 18 × 100 = (2 × 3^2) × (2^2 × 5^2) = 2^3 × 3^2 × 5^2.
For a perfect cube, each exponent must be a multiple of 3. The exponent of 2 is 3, which is fine. The exponent of 3 is 2, so we need one more 3. The exponent of 5 is 2, so we need one more 5.
So n = 3 × 5 = 15. Check: 1800 × 15 = 27000 = 30^3.
Exercise
Write 756 in canonical form. Then find the smallest positive integer by which 756 must be multiplied so that the product is a perfect square.
Show answer
Divide: 756 ÷ 2 = 378, 378 ÷ 2 = 189, 189 ÷ 3 = 63, 63 ÷ 3 = 21, 21 ÷ 3 = 7, and 7 ÷ 7 = 1. So 756 = 2^2 × 3^3 × 7. The exponents of 3 and 7 are odd, so the multiplier is 3 × 7 = 21. The product is 756 × 21 = 15876 = 126^2.
Exercise
How many trailing zeros does 12^5 × 35^4 have at the end?
Show answer
12^5 = 2^10 × 3^5, and 35^4 = 5^4 × 7^4. The product is 2^10 × 3^5 × 5^4 × 7^4. The number of trailing zeros is min(10, 4) = 4.