A prime number is a positive integer greater than 1 whose only divisors are 1 and itself.

Theorem (Fundamental Theorem of Arithmetic). For every n∈N+n \in \mathbb{N}^+ with n>1n > 1, nn has a unique prime factorization. That is, we can write

n=p1p2⋯pk, n = p_1 p_2 \cdots p_k,

where k≥1k \ge 1, each pip_i is prime, and

p1≤p2≤⋯≤pk. p_1 \le p_2 \le \cdots \le p_k.

The proof relies on Euclid's Lemma.


Euclid's Lemma. If pp is prime and p∣abp \mid ab, then p∣ap \mid a or p∣bp \mid b.

Corollary. If p∣q1q2⋯qℓp \mid q_1 q_2 \cdots q_\ell, then p∣qip \mid q_i for some i∈[ℓ]i \in [\ell].

Proof of Euclid's Lemma. Suppose pp is prime and p∤ap \nmid a. Then gcd⁡(a,p)=1\gcd(a, p) = 1, so aa has a multiplicative inverse modulo pp, denoted a−1∈Fpa^{-1} \in \mathbb{F}_p, with

a−1a≡1(modp). a^{-1} a \equiv 1 \pmod{p}.

If p∣abp \mid ab, then ab≡0(modp)ab \equiv 0 \pmod{p}. Multiplying both sides by a−1a^{-1} gives

b≡a−1ab≡0(modp), b \equiv a^{-1} ab \equiv 0 \pmod{p},

so p∣bp \mid b. A symmetric argument holds if p∤bp \nmid b. ∎


Proof of the Theorem. Suppose nn has two prime factorizations:

n=p1p2⋯pk=q1q2⋯qℓ. n = p_1 p_2 \cdots p_k = q_1 q_2 \cdots q_\ell.

Then p1∣q1q2⋯qℓp_1 \mid q_1 q_2 \cdots q_\ell. By the corollary to Euclid’s Lemma, p1∣qip_1 \mid q_i for some ii. Since both p1p_1 and qiq_i are primes, we must have p1=qip_1 = q_i.

Canceling this common factor from both sides and applying induction to the remaining product yields that the two factorizations must agree up to order. Thus, prime factorization is unique. ∎


Corollary. Let

n=p1d1p2d2⋯pkdk,m=q1f1q2f2⋯qℓfℓ, n = p_1^{d_1} p_2^{d_2} \cdots p_k^{d_k}, \quad m = q_1^{f_1} q_2^{f_2} \cdots q_\ell^{f_\ell},

where all pip_i and qjq_j are distinct primes. If n∣mn \mid m, then for each i∈[k]i \in [k], there exists some j∈[ℓ]j \in [\ell] such that

pi=qj,di≤fj. p_i = q_j, \quad d_i \le f_j.

Proof. Since n∣mn \mid m, every prime factor of nn must also divide mm. Applying Euclid’s Lemma repeatedly and canceling common prime factors shows that the exponent of each pip_i in nn cannot exceed its exponent in mm. This establishes the result. ∎