Lemma. Uniqueness of sorted prime factorisation [01FV]
- November 1, 2026
- Marcelo Fiore, Jon Sterling
Let \vec {p} and \vec {q} be two sorted nonempty finite sequences of primes. (By “sorted” we mean that \vec {p}_i \leq \vec {p}_{j} whenever i\leq j.) Then if \prod {\mathopen {}\left (\vec {p}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}}, then \vec {p} = \vec {q}.
Remark.
- November 1, 2026
- Marcelo Fiore, Jon Sterling
In other words, the function \prod that sends a sorted nonempty finite sequences of primes to its product is injective; we will learn about injectivity in future lectures, however.
Proof.
- November 1, 2026
- Marcelo Fiore, Jon Sterling
We will proceed by induction with basis 1 on the length of the first sequence of primes. In particular, let P{\mathopen {}\left (\ell \right )\mathclose {}} be the following statement:
For all sorted nonempty finite sequences of primes \vec {p} and \vec {q} such that \vec {p} has length \ell , if \prod {\mathopen {}\left (\vec {p}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}} then \vec {p}=\vec {q}.
We will show that P{\mathopen {}\left (\ell \right )\mathclose {}} holds for all \ell \geq 1 by induction as follows:
- Base case. To establish P{\mathopen {}\left (1\right )\mathclose {}}, we fix a prime p and a sorted nonempty finite sequence of primes \vec {q}, and we must show that if p = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}} then \vec {q} is the sequence that contains just the prime p. Our assumption says that \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}} is prime, and therefore (by definition) it cannot contain more than one element, so we are done.
Inductive step. We now fix a positive natural \ell \geq 1 and assume the induction hypothesis P{\mathopen {}\left (\ell \right )\mathclose {}}, and we must show that P{\mathopen {}\left (\ell +1\right )\mathclose {}} holds. To that end, we might fix \vec {p} of length \ell +1 and an arbitrary \vec {q} and we assume \prod {\mathopen {}\left (\vec {p}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}}.
By Euclid’s theorem, p_0 divides some q_i and therefore equals it. For the same reason, q_0 divides and therefore equals some p_j. Therefore we may deduce q_0 = p_0 as follows, using our assumption that the sequences were sorted:
q_0 \leq q_i = p_0 \qquad p_0 \leq p_j = q_0Writing \vec {r} and \vec {s} for the suffixes of \vec {p} and \vec {q} respectively obtained by removing their first elements, we have:
\begin {aligned} p_0 \cdot \prod {\mathopen {}\left (\vec {r}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {p}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}} = q_0\cdot \prod {\mathopen {}\left (\vec {s}\right )\mathclose {}} = p_0\cdot \prod {\mathopen {}\left (\vec {s}\right )\mathclose {}} \end {aligned}Therefore by cancellation, we have \prod {\mathopen {}\left (\vec {r}\right )\mathclose {}} = \prod {\mathopen {}\left (\vec {q}\right )\mathclose {}} and because \vec {r} is of length \ell , our induction hypothesis states that \vec {r} = \vec {s}. We therefore deduce \vec {p}=\vec {q}.