Kahibaro
Discord Login Register

16.1.1 Prime factorization

Prime factorization is about breaking a whole number down into a product of prime numbers. In the parent chapter “Divisibility and Primes” you have already met primes and divisibility, so here we focus on:

What is prime factorization?

A factorization of a positive integer $n$ is a way of writing $n$ as a product of integers greater than $1$.

A prime factorization of $n$ is a factorization of $n$ into prime numbers only. For example:

It is common to group equal primes using exponents:

Every prime number $p$ has the simplest possible prime factorization: just itself:
$$
p = p.
$$

By convention, $1$ is not written as a product of primes; it has no prime factorization, and we treat it as a special case.

Methods for finding prime factorizations

You already know how to test small primes and check divisibility from earlier material. Here we focus on standard systematic methods: factor trees and repeated division.

Factor trees

A factor tree is a diagram that shows how a number can be broken into factors step by step until only primes remain.

Example: Prime factorization of $72$.

  1. Start with $72$. Pick any nontrivial factorization, for instance $72 = 8 \cdot 9$.
  2. Factor $8$ and $9$ further:
    • $8 = 2 \cdot 4$
    • $9 = 3 \cdot 3$
  3. Factor $4$:
    • $4 = 2 \cdot 2$

Now every “leaf” (end of each branch) is prime:

So
$$
72 = 2 \cdot 2 \cdot 2 \cdot 3 \cdot 3 = 2^3 \cdot 3^2.
$$

Different choices at each step give different trees, but once you list and group the primes, you always get the same prime factorization.

Repeated division by primes

Another common method is repeated division by the smallest prime that divides the number.

Example: Prime factorization of $180$.

  1. Divide by $2$ as long as possible:
    • $180 \div 2 = 90$
    • $90 \div 2 = 45$
      Now $ is no longer divisible by $.
  2. Next prime is $3$:
    • $45 \div 3 = 15$
    • $15 \div 3 = 5$
  3. Now $5$ is prime.

So we have divided:
$$
180 = 2 \cdot 2 \cdot 3 \cdot 3 \cdot 5 = 2^2 \cdot 3^2 \cdot 5.
$$

You can arrange the steps in a table:

$$
\begin{array}{r|l}
2 & 180 \\
2 & 90 \\
3 & 45 \\
3 & 15 \\
5 & 5 \\
\hline
& 1
\end{array}
$$

The primes on the left are the prime factors.

When to stop factoring

In any method, you stop when all remaining factors are prime. Practically, that means:

If you are using repeated division and you have reduced the number down to $1$, then you have completely factored it.

The Fundamental Theorem of Arithmetic (idea)

The central theoretical fact behind prime factorization is:

Fundamental Theorem of Arithmetic (informal).
Every integer $n \ge 2$ can be written as a product of prime numbers, and this factorization is unique apart from the order of the factors.

“Unique apart from order” means:

This theorem justifies talking about the prime factorization of a number.

You will see more formal proofs and reasoning in other chapters on logic and proofs; here we use the idea as a tool.

Using prime factorization

Prime factorizations are powerful because they turn questions about divisibility and arithmetic into questions about exponents.

Assume
$$
a = p_1^{\alpha_1} p_2^{\alpha_2} \cdots p_k^{\alpha_k}, \qquad
b = p_1^{\beta_1} p_2^{\beta_2} \cdots p_k^{\beta_k},
$$
where $p_1, \dots, p_k$ are the distinct primes that appear in either $a$ or $b$, and exponents can be zero if a prime does not actually appear.

Testing divisibility via prime factors

A number $a$ divides $b$ (written $a \mid b$) exactly when, for every prime $p$, the exponent of $p$ in $a$ is less than or equal to the exponent of $p$ in $b$.

Example: Does $18$ divide $540$?

Compare exponents:

So $18 \mid 540$.

Greatest common divisor (gcd) via prime factors

If you know the factorizations of $a$ and $b$, their greatest common divisor $\gcd(a,b)$ can be found by taking the minimum exponents of each prime:

$$
\gcd(a,b) = p_1^{\min(\alpha_1,\beta_1)} p_2^{\min(\alpha_2,\beta_2)} \cdots p_k^{\min(\alpha_k,\beta_k)}.
$$

Example: $\gcd(72, 180)$.

For each prime:

Thus:
$$
\gcd(72, 180) = 2^2 \cdot 3^2 = 36.
$$

Formal algorithms for the gcd (like the Euclidean algorithm) are treated elsewhere; here the focus is how prime factors encode the same information.

Least common multiple (lcm) via prime factors

The least common multiple $\operatorname{lcm}(a,b)$ can be obtained by taking the maximum exponents of each prime:

$$
\operatorname{lcm}(a,b) = p_1^{\max(\alpha_1,\beta_1)} p_2^{\max(\alpha_2,\beta_2)} \cdots p_k^{\max(\alpha_k,\beta_k)}.
$$

Continuing the example: $\operatorname{lcm}(72, 180)$.

For each prime:

So:
$$
\operatorname{lcm}(72, 180) = 2^3 \cdot 3^2 \cdot 5 = 360.
$$

There is an important relationship:
$$
\gcd(a,b) \cdot \operatorname{lcm}(a,b) = a \cdot b,
$$
which can also be understood using prime exponents.

Simplifying fractions using prime factorizations

When you have a fraction $\dfrac{a}{b}$ with $a$ and $b$ positive integers, factoring numerator and denominator into primes makes simplification straightforward.

Example: Simplify $\dfrac{180}{252}$.

Factor each:

Cancel common prime factors:
$$
\frac{2^2 \cdot 3^2 \cdot 5}{2^2 \cdot 3^2 \cdot 7}
= \frac{5}{7}.
$$

In effect, you are dividing numerator and denominator by their gcd, which can be seen directly from their prime factorizations.

Typical patterns and observations

Some useful special cases and patterns:

These patterns are heavily used later in number theory and in various problem-solving techniques.

Limitations and practical notes

For small to moderately large integers, the methods described (factor trees, repeated division) are perfectly adequate. For very large integers, especially in cryptographic applications, finding prime factorizations becomes difficult and requires more advanced algorithms, which are beyond this chapter.

Here you should aim to:

These skills form a basic toolkit for many topics later in number theory and beyond.

Views: 64

Comments

Please login to add a comment.

Don't have an account? Register now!