Home › Arithmetic › Lesson 6

The Fundamental Theorem of Arithmetic

Lesson 6 of 12

Key idea of this section

Every integer n ≥ 2 is a product of primes, uniquely up to order:
n = p₁e₁ · p₂e₂ ⋯ pₖeₖ.
The engine is Euclid's lemma: if p is prime and p | ab, then p | a or p | b.
Unique factorisation can fail: in ℤ[√−5], 6 = 2 · 3 = (1 + √−5)(1 − √−5).

Irreducible versus prime

In an integral domain R, a nonzero non-unit p is irreducible if p = ab forces a or b to be a unit, and prime if p | ab forces p | a or p | b. Every prime is irreducible: if p = ab then p divides a or b, say a = pc, so p = pcb and cb = 1. In ℤ the usual definition of a prime number (no divisors other than ±1 and ±p) is irreducibility; that it coincides with primality is the content of the next lemma.

Lemma 6.1 (Euclid's lemma, Elements VII.30). If p ∈ ℤ is irreducible and p | ab, then p | a or p | b.

Proof. Suppose p ∤ a. The only positive divisors of p are 1 and p, so gcd(p, a) = 1, and by Bézout px + ay = 1 for some x, y. Multiplying by b, pbx + aby = b; p divides both terms on the left, hence p | b. ∎

The same proof works in any PID, so in a PID irreducibles are prime.

Theorem 6.2 (Fundamental theorem of arithmetic). Every integer n ≥ 2 can be written as a product of primes, and the factorisation is unique up to the order of the factors.

Proof. Existence by strong induction: if n is prime we are done; otherwise n = ab with 1 < a, b < n, and both a and b are products of primes by the induction hypothesis. Uniqueness: suppose p₁ ⋯ pᵣ = q₁ ⋯ qₛ with all factors prime. Then p₁ divides the product of the q's, and by Euclid's lemma (extended to several factors by induction) p₁ | qⱼ for some j, so p₁ = qⱼ. Cancel and induct on r. ∎

The theorem was used implicitly from antiquity, but its first clear statement and proof appear in Gauss's Disquisitiones Arithmeticae (1801), Article 16. Gauss recognised that uniqueness is not self-evident; the examples below show why.

Valuations: the p-adic order

For a prime p and nonzero integer n, the p-adic valuation vₚ(n) is the exponent of p in the factorisation of n; it extends to nonzero rationals by vₚ(a/b) = vₚ(a) − vₚ(b). The fundamental theorem says that the map n ↦ (vₚ(n))ₚ is an isomorphism of the multiplicative monoid of positive integers onto the monoid of finitely supported sequences of natural numbers indexed by the primes. In these coordinates

vₚ(ab) = vₚ(a) + vₚ(b)
vₚ(gcd(a, b)) = min(vₚ(a), vₚ(b)),     vₚ(lcm(a, b)) = max(vₚ(a), vₚ(b))
vₚ(a + b) ≥ min(vₚ(a), vₚ(b))

and gcd(a, b) · lcm(a, b) = ab for positive a, b because min + max = sum. The last inequality is the starting point of p-adic analysis: |x|ₚ = p−vₚ(x) is an absolute value on ℚ satisfying the strong triangle inequality |x + y|ₚ ≤ max(|x|ₚ, |y|ₚ).

Theorem 6.3 (Legendre's formula, 1808). For a prime p and n ≥ 1,

vₚ(n!) = ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + ⋯ = (n − sₚ(n))/(p − 1),

where sₚ(n) is the sum of the base-p digits of n.

Proof. vₚ(n!) = Σ (k = 1 to n) vₚ(k). The number of k ≤ n with pʲ | k is ⌊n/pʲ⌋, and each k is counted once for every j with 1 ≤ j ≤ vₚ(k). For the second expression write n = Σ dᵢ pⁱ; then ⌊n/pʲ⌋ = Σ (i ≥ j) dᵢ pi−j, and summing over j ≥ 1 gives Σ dᵢ (pⁱ − 1)/(p − 1) = (n − sₚ(n))/(p − 1). ∎

For example v₂(100!) = 50 + 25 + 12 + 6 + 3 + 1 = 97, and 100 = 1100100₂ has digit sum 3, so (100 − 3)/1 = 97 as well. The number of trailing zeros of 100! is v₅(100!) = 20 + 4 = 24, since v₂(100!) ≥ v₅(100!).

Two classical consequences

Theorem 6.4 (Euclid, Elements IX.20). There are infinitely many primes.

Proof. Given primes p₁, …, pₖ, any prime factor of p₁p₂⋯pₖ + 1 differs from every pᵢ, since pᵢ divides the product and would then divide 1. ∎

Theorem 6.5. If n ≥ 1 is not a perfect k-th power, then the real k-th root of n is irrational.

Proof. If n1/k = a/b with positive integers a, b then n bᵏ = aᵏ, so vₚ(n) + k · vₚ(b) = k · vₚ(a) for every prime p; hence k | vₚ(n) for all p, and n is a k-th power. ∎

Failure of unique factorisation

In R = ℤ[√−5] = {a + b√−5 : a, b ∈ ℤ}, the norm N(a + b√−5) = a² + 5b² is multiplicative. We have

6 = 2 · 3 = (1 + √−5)(1 − √−5),   with norms  N(2) = 4,  N(3) = 9,  N(1 ± √−5) = 6

A proper factor of any of these four elements would have norm 2 or 3, but a² + 5b² = 2 and a² + 5b² = 3 have no integer solutions; so all four are irreducible. They are not associates (the only units are ±1). Thus 6 has two essentially different factorisations into irreducibles, and 2 is irreducible but not prime: it divides (1 + √−5)(1 − √−5) = 6 but neither factor, since (1 ± √−5)/2 ∉ R. Kummer's attempt to rescue unique factorisation in rings of cyclotomic integers (1840s), motivated by Fermat's Last Theorem, led to his ideal numbers, which Dedekind reformulated as ideals: in the ring of integers of any number field, every nonzero ideal factors uniquely into prime ideals. Here (6) = 𝔭² 𝔮 𝔮′ with 𝔭 = (2, 1 + √−5), 𝔮 = (3, 1 + √−5) and 𝔮′ = (3, 1 − √−5). The failure of unique factorisation of elements is measured by the ideal class group, which for ℤ[√−5] has order 2.

Exercise

  • (a)
    Compute v₃(200!) by Legendre's formula, and check it with the digit-sum formula.
  • (b)
    Find gcd(2⁴·3²·7, 2²·3⁵·5) and the corresponding lcm, and verify gcd · lcm = product.
  • (c)
    Show that 3 is irreducible but not prime in ℤ[√−5].
Show solution

Answers: (a) ⌊200/3⌋ + ⌊200/9⌋ + ⌊200/27⌋ + ⌊200/81⌋ = 66 + 22 + 7 + 2 = 97. In base 3, 200 = 21102₃ (2·81 + 1·27 + 1·9 + 0·3 + 2 = 200), with digit sum 6, and (200 − 6)/2 = 97. (b) gcd = 2²·3² = 36 and lcm = 2⁴·3⁵·5·7 = 136080. The numbers are 1008 and 4860, and 1008 · 4860 = 4898880 = 36 · 136080. (c) Irreducible: a proper factor would have norm 3, impossible since a² + 5b² = 3 has no solution. Not prime: 3 divides 6 = (1 + √−5)(1 − √−5) but (1 ± √−5)/3 ∉ ℤ[√−5].

V.3.1