taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.4-21

Exercise 1.2.4-21

proved in Lean solution written

RatingM22
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Prove that every integer n>1n > 1 is a product of primes in exactly one way when the factors are listed in nondecreasing order.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Existence is Exercise 1.2.1-5: strong induction on nn.

Hint 2

For uniqueness first prove that a prime that divides a product divides one of the factors. This is Law B.

Hint 3

Then compare the smallest prime of two factorizations and use induction on nn.

Solution

Show the solution

Existence. Use strong induction on n≥2n \ge 2. If nn is a prime, it is a product with one factor. Otherwise n=abn = ab with 1<a,b<n1 < a, b < n. By the induction hypothesis, aa and bb are products of primes. Join the two lists and sort. This is a factorization of nn.

Euclid's lemma. Let pp be a prime and let p∣abp \mid ab. Claim: p∣ap \mid a or p∣bp \mid b. Suppose p∤ap \nmid a. The number gcd⁡(a,p)\gcd(a, p) divides pp, so it is 11 or pp, and it is not pp since p∤ap \nmid a. So a⊥pa \perp p. Now ab≡0=a⋅0(modp)ab \equiv 0 = a \cdot 0 \pmod p, and Law B (with the factor aa) gives b≡0(modp)b \equiv 0 \pmod p. By induction on the number of factors, if a prime pp divides q1q2⋯qlq_1 q_2 \cdots q_l, then pp divides some qiq_i. If all qiq_i are primes, then p∣qip \mid q_i with p>1p > 1 forces p=qip = q_i.

Uniqueness. Use strong induction on nn. Let n=p1⋯pk=q1⋯qln = p_1 \cdots p_k = q_1 \cdots q_l be two factorizations into primes with p1≤⋯≤pkp_1 \le \cdots \le p_k and q1≤⋯≤qlq_1 \le \cdots \le q_l. The prime p1p_1 divides q1⋯qlq_1 \cdots q_l, so p1=qip_1 = q_i for some ii, and p1=qi≥q1p_1 = q_i \ge q_1. In the same way q1=pj≥p1q_1 = p_j \ge p_1 for some jj. So p1=q1p_1 = q_1. Cancel it: p2⋯pk=q2⋯ql=n/p1p_2 \cdots p_k = q_2 \cdots q_l = n/p_1. If n/p1=1n/p_1 = 1, both lists are empty, since each prime is at least 22. Otherwise 1<n/p1<n1 < n/p_1 < n and the induction hypothesis says that the two lists are equal. □\square

Check

360=2⋅2⋅2⋅3⋅3⋅5360 = 2 \cdot 2 \cdot 2 \cdot 3 \cdot 3 \cdot 5. A computer search over 2≤n≤50002 \le n \le 5000 that lists all nondecreasing tuples of primes with product nn finds exactly one tuple for each nn. The uniqueness fails in the number system of the numbers a+b−5a + b\sqrt{-5} with integers aa, bb, where 6=2⋅3=(1+−5)(1−−5)6 = 2 \cdot 3 = (1 + \sqrt{-5})(1 - \sqrt{-5}).

Remarks

Uniqueness is false in some other number systems, as the example with −5\sqrt{-5} shows, so the proof must use the property of the integers that Euclid's lemma expresses. Exercises 1.2.4-27 to 1.2.4-31 use the theorem.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.