Home page for accesible maths 4 Number theory

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

4.7 Applications of prime factorization

The Fundamental Theorem of Arithmetic (Theorem 4.6.5) has a number of important consequences; in this section we shall explore some of them. The first goes back all the way to Euclid (again!), and concerns the question of how many prime numbers there are.

At the beginning of Section 4.6 we saw the technique of the Sieve of Eratosthenes to find the first few prime numbers; it consisted of taking a grid of the first so many natural numbers and crossing out all multiples of 22, then all multiples of 33, then all multiples of 55 and so on, and afterwards the numbers which remained were the primes. We took only a fairly small grid, with the numbers up to 100100; if we had taken a larger grid (say, all the numbers up to 1 000 0001\>000\>000), we would have had to go through rather more times crossing out. Is it possible that, if we were to go far enough, there would come a point beyond which all the numbers were crossed out? In other words, might there only be a finite number of prime numbers? Euclid was able to show that the answer to these questions is ‘‘no’’. We shall give Euclid’s proof, essentially unchanged after more than 20002000 years.

Theorem 4.7.1

There are infinitely many prime numbers in ℕ\mathbb{N}.

Proof. The proof is by contradiction. Assume that there are only finitely many prime numbers, say p1,p2,…,pnp_{1},p_{2},\dots,p_{n}, where n∈ℕn\in\mathbb{N}, and consider the number

N=p1⁢p2⁢⋯⁢pn+1.N=p_{1}p_{2}\cdots p_{n}+1.

Theorem 4.6.5 implies that NN can be written as a product of primes, so pjp_{j} must divide NN for some j∈{1,2,…,n}j\in\{1,2,\ldots,n\}; but this is a contradiction, since NN is of the form q⁢pj+1qp_{j}+1 for some q∈ℕq\in\mathbb{N}. Thus there must be infinitely many prime numbers in ℕ\mathbb{N}. □\Box

There we are; just a few short lines of argument, but they settle the matter beyond any doubt, showing in particular how powerful the technique of proof by contradiction is.

Euclid’s result above did not require the full force of the Fundamental Theorem of Arithmetic, since it only needed the existence of prime factorizations, not their uniqueness. In the other applications which we shall consider, both parts of the Fundamental Theorem of Arithmetic will be needed.

We begin with a notational convention: it is customary to write the factors in a product of primes in ascending order of size, and to collect together equal factors, writing pap^{a} for aa factors equal to pp. Thus we write a given number nn as p1a1⁢p2a2⁢⋯⁢prar{p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}} for some r∈ℕr\in\mathbb{N}, where p1,p2,…,prp_{1},p_{2},\ldots,p_{r} are prime numbers with p1<p2<⋯<prp_{1}<p_{2}<\cdots<p_{r}, and a1,a2,…,ar∈ℕa_{1},a_{2},\ldots,a_{r}\in\mathbb{N}. (Note that this notation does not imply that p1,p2,…,prp_{1},p_{2},\dots,p_{r} are the first rr prime numbers.)

Example 4.7.2

1400=14⋅100=2⋅7⋅22⋅52=23⋅52⋅7.1400=14\cdot 100=2\cdot 7\cdot 2^{2}\cdot 5^{2}=2^{3}\cdot 5^{2}\cdot 7.

It is often convenient to relax the requirement a1,…,ar∈ℕa_{1},\ldots,a_{r}\in\mathbb{N} to a1,…,ar∈ℕ0a_{1},\ldots,a_{r}\in\mathbb{N}_{0}, with the obvious convention that p0=1p^{0}=1 (this is particularly useful when comparing the prime factorizations of two or more numbers). Given the prime factorization of a natural number, it is now easy to obtain its positive factors.

Proposition 4.7.3

Let n=p1a1⁢p2a2⁢⋯⁢prarn={p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}}, where r∈ℕr\in\mathbb{N}, p1<p2<⋯<prp_{1}<p_{2}<\cdots<p_{r} are prime numbers, and a1,a2,…,ar∈ℕa_{1},a_{2},\ldots,a_{r}\in\mathbb{N}. Then a natural number mm is a factor of nn if and only if m=p1b1⁢p2b2⁢⋯⁢prbrm={p_{1}}^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}, where bj∈{0,1,…,aj}b_{j}\in\{0,1,\ldots,a_{j}\} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}.

Example 4.7.4

The positive factors of 14001400 are of the form

2j⋅5k⋅7ℓ, where j∈{0,1,2,3}, k∈{0,1,2}, and ℓ∈{0,1}.2^{j}\cdot 5^{k}\cdot 7^{\ell},\quad\text{where}\quad j\in\{0,1,2,3\},\quad k% \in\{0,1,2\},\quad\text{and}\quad\ell\in\{0,1\}.

Thus the set of all positive factors of 14001400 is

{1,2,4,8,5,10,20,40,25,50,100,200,7,14,28,56,35,70,140,280,175,350,700,1400}.\{1,2,4,8,5,10,20,40,25,50,100,200,\\ 7,14,28,56,35,70,140,280,175,350,700,1400\}.

Proof. ‘‘⇒\Rightarrow.’’ Suppose that m∈ℕm\in\mathbb{N} is a factor of nn, say n=m⁢qn=mq, where q∈ℕq\in\mathbb{N}. Since the prime factorization of m⁢qmq is obtained by joining together those of mm and qq, the only possible prime factors of mm and qq are p1,p2,…,prp_{1},p_{2},\dots,p_{r}. Writing

m=p1b1⁢p2b2⁢⋯⁢prbr  and  q=p1c1⁢p2c2⁢⋯⁢prcr,m={p_{1}}^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}\qquad\text{and}\qquad q=% {p_{1}}^{c_{1}}{p_{2}}^{c_{2}}\cdots{p_{r}}^{c_{r}},

we obtain

p1a1⁢p2a2⁢⋯⁢prar=n=m⁢q\displaystyle{p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}}=n=mq =p1b1⁢p2b2⁢⋯⁢prbr⁢p1c1⁢p2c2⁢⋯⁢prcr\displaystyle={p_{1}}^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}{p_{1}}^{c_{1% }}{p_{2}}^{c_{2}}\cdots{p_{r}}^{c_{r}}
=p1b1+c1⁢p2b2+c2⁢⋯⁢prbr+cr.\displaystyle={p_{1}}^{b_{1}+c_{1}}{p_{2}}^{b_{2}+c_{2}}\cdots{p_{r}}^{b_{r}+c% _{r}}.

Using the uniqueness of prime factorization, we may equate powers of pjp_{j}, from which we conclude that aj=bj+cj⩾bja_{j}=b_{j}+c_{j}\geqslant b_{j} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}.

‘‘⇐\Leftarrow’’. Conversely, it is clear that each number of the form m=p1b1⁢p2b2⁢⋯⁢prbrm={p_{1}}^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}, where bj∈{0,1,…,aj}b_{j}\in\{0,1,\ldots,a_{j}\} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}, is a factor of nn. □\Box

This result enables us to compute the number of positive factors of a given number.

Corollary 4.7.5

Let n=p1a1⁢p2a2⁢⋯⁢prarn={p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}}, where r∈ℕr\in\mathbb{N}, p1<p2<⋯<prp_{1}<p_{2}<\cdots<p_{r} are prime numbers, and a1,a2,…,ar∈ℕa_{1},a_{2},\ldots,a_{r}\in\mathbb{N}. Then nn has (a1+1)⁢(a2+1)⁢⋯⁢(ar+1)(a_{1}+1)(a_{2}+1)\cdots(a_{r}+1) positive factors.

Example 4.7.6

The number of positive factors of 14001400 is

(3+1)⁢(2+1)⁢(1+1)=4⋅3⋅2=24.(3+1)(2+1)(1+1)=4\cdot 3\cdot 2=24.

Proof. This follows from Proposition 4.7.3, as there are aj+1a_{j}+1 choices for each bj.b_{j}. □\Box

Example 4.7.7

The factors of 200=23⋅52200=2^{3}\cdot 5^{2} are 2j⁢5k2^{j}5^{k} with j∈{0,1,2,3}j\in\{0,1,2,3\} and k∈{0,1,2}k\in\{0,1,2\}, that is, 1,2,4,5,8,10,20,25,40,50,100,2001,2,4,5,8,10,20,25,40,50,100,200; the number of factors is (3+1)⁢(2+1)=4⋅3=12.(3+1)(2+1)=4\cdot 3=12.

In this example we can display the factors in a 22-dimensional array as follows:

20⋅5020⋅5120⋅5221⋅5021⋅5121⋅5222⋅5022⋅5122⋅5223⋅5023⋅5123⋅52    or    152521050420100840200.\begin{array}[]{ccc}2^{0}\cdot 5^{0}&2^{0}\cdot 5^{1}&2^{0}\cdot 5^{2}\\ 2^{1}\cdot 5^{0}&2^{1}\cdot 5^{1}&2^{1}\cdot 5^{2}\\ 2^{2}\cdot 5^{0}&2^{2}\cdot 5^{1}&2^{2}\cdot 5^{2}\\ 2^{3}\cdot 5^{0}&2^{3}\cdot 5^{1}&2^{3}\cdot 5^{2}\end{array}\qquad\qquad\hbox% {or}\qquad\qquad\begin{array}[]{ccc}1&5&25\\ 2&10&50\\ 4&20&100\\ 8&40&200{\text{\makebox[0.0pt][l]{$.$}}}\end{array}

If there are more than two primes involved, it is not quite so easy to arrange the array on the page; but the idea is the same.

We next introduce a standard piece of notation.

Notation 4.7.8

Given a,b∈ℝa,b\in\mathbb{R}, we write min⁡{a,b}\min\{a,b\} for the smaller of aa and bb and max⁡{a,b}\max\{a,b\} for the larger.

Lemma 4.7.9

For all a,b∈ℝa,b\in\mathbb{R}, min⁡{a,b}+max⁡{a,b}=a+b\min\{a,b\}+\max\{a,b\}=a+b.

Proof. We may assume a⩽ba\leqslant b, and then min⁡{a,b}=a\min\{a,b\}=a and max⁡{a,b}=b.\max\{a,b\}=b. □\Box

We can now explain how prime factorizations can be used to find the highest common factor and lowest common multiple of two natural numbers.

Proposition 4.7.10

Let m=p1a1⁢p2a2⁢⋯⁢prarm={p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}} and n=p1b1⁢p2b2⁢⋯⁢prbrn={p_{1}}^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}, where r∈ℕr\in\mathbb{N}, p1<p2<⋯<prp_{1}<p_{2}<\cdots<p_{r} are prime numbers, and a1,a2,…,ar,b1,b2,…,br∈ℕ0a_{1},a_{2},\ldots,a_{r},b_{1},b_{2},\ldots,b_{r}\in\mathbb{N}_{0}. Then

hcf⁢(m,n)=p1c1⁢p2c2⁢⋯⁢prcr  𝑎𝑛𝑑  lcm⁢(m,n)=p1d1⁢p2d2⁢⋯⁢prdr,\mathrm{hcf}(m,n)={p_{1}}^{c_{1}}{p_{2}}^{c_{2}}\cdots{p_{r}}^{c_{r}}\qquad% \hbox{and}\qquad\mathrm{lcm}(m,n)={p_{1}}^{d_{1}}{p_{2}}^{d_{2}}\cdots{p_{r}}^% {d_{r}},

where cj=min⁡{aj,bj}c_{j}=\min\{a_{j},b_{j}\} and dj=max⁡{aj,bj}d_{j}=\max\{a_{j},b_{j}\} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}.

Example 4.7.11

Given m=240m=240 and n=108n=108, the prime factorizations are

m=24⋅10=23⋅3⋅2⋅5=24⋅3⋅5  and  n=4⋅27=22⋅33,m=24\cdot 10=2^{3}\cdot 3\cdot 2\cdot 5=2^{4}\cdot 3\cdot 5\qquad\text{and}% \qquad n=4\cdot 27=2^{2}\cdot 3^{3},

so hcf⁢(m,n)=22⋅3=12\mathrm{hcf}(m,n)=2^{2}\cdot 3=12 and lcm⁢(m,n)=24⋅33⋅5=2160.\mathrm{lcm}(m,n)=2^{4}\cdot 3^{3}\cdot 5=2160.

Proof. By Proposition 4.7.3, each factor kk of mm has the form k=p1e1⁢p2e2⁢⋯⁢prerk={p_{1}}^{e_{1}}{p_{2}}^{e_{2}}\cdots{p_{r}}^{e_{r}}, where ej⩽aje_{j}\leqslant a_{j} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}; if kk is also to be a factor of nn, we require that ej⩽bje_{j}\leqslant b_{j} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\} as well. Thus the set of common factors of mm and nn consists of the numbers k=p1e1⁢p2e2⁢⋯⁢prerk={p_{1}}^{e_{1}}{p_{2}}^{e_{2}}\cdots{p_{r}}^{e_{r}} with ej⩽aj,bje_{j}\leqslant a_{j},b_{j} for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\}; the largest possible such value of eje_{j} is cj=min⁡{aj,bj}c_{j}=\min\{a_{j},b_{j}\}, so the highest common factor is as described.

Theorem 4.5.5 implies that

lcm⁢(m,n)=m⁢nhcf⁢(m,n)\displaystyle\mathrm{lcm}(m,n)=\frac{mn}{\mathrm{hcf}(m,n)} =p1a1⁢p2a2⁢⋯⁢prar⁢p1b1⁢p2b2⁢⋯⁢prbrp1c1⁢p2c2⁢⋯⁢prcr\displaystyle=\frac{{p_{1}}^{a_{1}}{p_{2}}^{a_{2}}\cdots{p_{r}}^{a_{r}}{p_{1}}% ^{b_{1}}{p_{2}}^{b_{2}}\cdots{p_{r}}^{b_{r}}}{{p_{1}}^{c_{1}}{p_{2}}^{c_{2}}% \cdots{p_{r}}^{c_{r}}}
=p1d1⁢p2d2⁢⋯⁢prdr,\displaystyle={p_{1}}^{d_{1}}{p_{2}}^{d_{2}}\cdots{p_{r}}^{d_{r}},

where, for each j∈{1,2,…,r}j\in\{1,2,\ldots,r\},

dj=aj+bj-cj=aj+bj-min⁡{aj,bj}=max⁡{aj,bj}d_{j}=a_{j}+b_{j}-c_{j}=a_{j}+b_{j}-\min\{a_{j},b_{j}\}=\max\{a_{j},b_{j}\}

by Lemma 4.7.9, as required. □\Box