Prime Factorization
Learning objectives
- State the Fundamental Theorem of Arithmetic
- Use Euclid’s lemma to prove uniqueness of factorisation
- Apply the Sieve of Eratosthenes to enumerate primes
- Reproduce Euclid’s proof of the infinitude of primes
If integers are the atoms of arithmetic, primes are the protons. Every positive integer above breaks down into primes in exactly one way, and that uniqueness is the single most important fact in all of elementary number theory. It is what makes modular arithmetic well-behaved, what makes RSA encryption a one-way street (multiplying two huge primes is fast; factoring their product takes geological time on classical hardware), and what makes “find a hash collision” a meaningful challenge in cryptocurrency proof-of-work. Cantor used uniqueness of factorisation to encode finite sets as integers; Gödel used it to encode logical proofs as integers. The Fundamental Theorem of Arithmetic earns its name.
Primes and composites
An integer is prime if its only positive divisors are and . Otherwise (and ) it is composite. The integer is neither — treating it as prime would break uniqueness of factorisation (you could insert any number of factors).
The Fundamental Theorem of Arithmetic
Every integer can be written as where the are distinct primes and the , and this representation is unique up to the order of the factors. Existence follows from strong induction: either is prime (done) or for some , both of which factor by the induction hypothesis.
Uniqueness requires a deeper tool, Euclid’s lemma: if a prime divides , then or . Proof: if , then (the only divisors of are and ). By Bezout, ; multiplying by gives , and since , divides both terms on the left, hence . Iterating Euclid’s lemma forces any two factorisations of to match prime-by-prime.
The Sieve of Eratosthenes
To list every prime : write . Cross out the multiples of (except itself); move to the next surviving number () and cross out its multiples; continue with up to . Whatever survives is prime. Reason for stopping at : a composite must have a divisor , so it would have already been crossed out.
Euclid’s proof of infinitely many primes
Suppose for contradiction the complete list of primes is . Consider . Then , so it has a prime factor . But cannot be any , because dividing by leaves remainder . So is a prime missing from our supposedly complete list — contradiction. (Note: itself is not necessarily prime; the argument only needs that some prime factor of lies outside the list.)
Pause and think: Why does the FTA fail if we allow as a prime? Try writing the factorisation of in two ways using as a permitted factor — you will see immediately why has to be excluded.
Try it
- Predict first: how many primes lie between and ? Then run the Sieve mentally (cross out multiples of ; , so stop there) and count.
- Factorise into primes. (It is famous for having lots of small factors.) Use your factorisation to compute the number of positive divisors of .
- Verify Euclid’s construction with as the “complete” list: . Is prime? Repeat with : is prime? (It is not — see if you can factor it.)
- Two-step puzzle: explain why is never prime when . (Factor as a product first.)
A trap to watch for
It is tempting to test whether is prime by checking divisibility for every integer up to — but you only need to test up to . Reason: if with , then . So either you find a factor , or there is none and is prime. A related trap: Euclid’s proof shows there are infinitely many primes, but it does not show that is itself prime — only that some prime factor of it is new. Students sometimes mis-remember this as “the Euclid construction always produces a new prime,” which is false (try above).
What you now know
You can decompose any integer into primes, justify the uniqueness of that decomposition via Euclid’s lemma, sieve out primes up to a given bound, and produce Euclid’s elegant contradiction proof that primes go on forever. Next section, modular arithmetic, recasts “same prime factorisation up to” ideas as algebra on equivalence classes.
References
- Velleman, D. J. (2019). How to Prove It: A Structured Approach (3rd ed.). Cambridge University Press, §7.2.
- Hardy, G. H., Wright, E. M. (2008). An Introduction to the Theory of Numbers (6th ed.). Oxford University Press, ch. 1–2.
- Niven, I., Zuckerman, H. S., Montgomery, H. L. (1991). An Introduction to the Theory of Numbers (5th ed.). Wiley, ch. 1–2.
- Rosen, K. H. (2010). Elementary Number Theory (6th ed.). Pearson, ch. 3.
- Koblitz, N. (1994). A Course in Number Theory and Cryptography (2nd ed.). Springer, ch. 1.