01 / 21
P

Prime Numbers &
Factorization

Explore the building blocks of integers: learn what makes a number prime, master prime factorization, and discover why every integer has a unique decomposition.

Discrete Math

What Is a Prime Number?

A prime number is an integer greater than \(1\) whose only positive divisors are \(1\) and itself. If \(p\) is prime and \(a \mid p\), then \(a = 1\) or \(a = p\).

Prime
\(2, 3, 5, 7, 11, 13\) : exactly two positive divisors
Composite
\(4, 6, 8, 9, 12, 15\) : more than two positive divisors

Why Do Primes Matter?

Primes are the atoms of arithmetic. Every integer greater than \(1\) can be built from them. This idea underpins modern cryptography, computer science, and abstract algebra.

Cryptography
RSA encryption relies on the difficulty of factoring large semiprimes
Number Theory
Primes control the structure of \(\mathbb{Z}\), rings, and modular systems
Algorithms
Hash functions, random number generators, and primality tests use primes

Visualizing Primes on a Number Line

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Prime Composite

The Fundamental Theorem of Arithmetic

This theorem guarantees that prime factorization is well-defined. No matter how you factor an integer, you always arrive at the same set of prime powers.

Existence
Every \(n > 1\) has at least one prime factorization
Uniqueness
There is exactly one way to write \(n\) as an ordered product of primes

Factor Tree: \(60\)

60 2 30 3 10 2 5 Prime Composite

Prime vs. Composite

Prime Composite
Divisor Count Exactly \(2\) \(\geq 3\)
Smallest Example \(2\) \(4\)
Even Members Only \(2\) \(4, 6, 8, 10, \ldots\)
Factorization \(p = p\) \(n = p_1^{a_1} \cdots p_k^{a_k}\), \(k \geq 2\) or \(a_1 \geq 2\)
Role in FTA Building block Product of building blocks

How to Test for Primality

To check whether \(n\) is prime, you only need to test divisors up to \(\sqrt{n}\). If no prime \(p \leq \sqrt{n}\) divides \(n\), then \(n\) is prime.

1
Compute \(\sqrt{n}\). Round down to the nearest integer.
2
List primes up to \(\sqrt{n}\): \(2, 3, 5, 7, 11, \ldots\)
3
Divide \(n\) by each. If any divides evenly, \(n\) is composite.
4
If none divide evenly, then \(n\) is prime.

How to Prime Factorize

1
Start with the smallest prime \(p = 2\). Divide \(n\) by \(p\) as many times as possible.
2
Move to the next prime (\(3, 5, 7, \ldots\)) and repeat.
3
Stop when the quotient equals \(1\). Record each prime and its exponent.
4
Write the result as \(n = p_1^{a_1} \cdot p_2^{a_2} \cdots p_k^{a_k}\).

Example: Factorize \(84\)

84 2 42 2 21 3 7 7 1
\(84 =\) \(2^2 \cdot 3 \cdot 7\)

Example: Factorize \(360\)

360 2 180 2 90 2 45 3 15 3 5 5 1
\(360 =\) \(2^3 \cdot 3^2 \cdot 5\)

Example: Is \(97\) Prime?

We need to check all primes up to \(\sqrt{97} \approx 9.85\). That means testing: \(2, 3, 5, 7\).

1
\(97 \div 2 = 48.5\) : not divisible
2
\(97 \div 3 = 32.33\ldots\) : not divisible
3
\(97 \div 5 = 19.4\) : not divisible
4
\(97 \div 7 = 13.86\ldots\) : not divisible

GCD and LCM from Factorizations

Given \(a = p_1^{a_1} \cdots p_k^{a_k}\) and \(b = p_1^{b_1} \cdots p_k^{b_k}\) (using exponent \(0\) for missing primes):

GCD
\(\gcd(a,b) = \prod p_i^{\min(a_i, b_i)}\)
Take the smaller exponent for each prime
LCM
\(\text{lcm}(a,b) = \prod p_i^{\max(a_i, b_i)}\)
Take the larger exponent for each prime

Example: \(\gcd(84, 360)\) and \(\text{lcm}(84, 360)\)

Prime \(84\) \(360\) min max
\(2\) \(2^2\) \(2^3\) \(2^2\) \(2^3\)
\(3\) \(3^1\) \(3^2\) \(3^1\) \(3^2\)
\(5\) \(5^0\) \(5^1\) \(5^0\) \(5^1\)
\(7\) \(7^1\) \(7^0\) \(7^0\) \(7^1\)

Common Mistakes

✕ Calling 1 Prime
By convention, \(1\) is neither prime nor composite. It has only one divisor.
✕ Forgetting 2 Is Prime
\(2\) is the smallest and only even prime. Don't skip it when factoring.
✕ Stopping Too Early
You must test divisors up to \(\sqrt{n}\), not just the first few primes.
✕ Mixing GCD/LCM
GCD uses min exponents. LCM uses max exponents. Swapping them gives wrong answers.
✕ Incomplete Factorization
Stopping before reaching \(1\) means you've left composite factors unbroken.

Key Takeaways

Prime
Integer > 1 with exactly two positive divisors
FTA
Every \(n > 1\) has a unique prime factorization
Trial Division
Test primes up to \(\sqrt{n}\) for primality checks
GCD
Minimum exponents from prime factorizations
LCM
Maximum exponents from prime factorizations

Question 1 of 5

Which of the following numbers is prime?

Question 2 of 5

What is the prime factorization of \(180\)?

Question 3 of 5

Given \(a = 2^3 \cdot 3 \cdot 7\) and \(b = 2^2 \cdot 3^2 \cdot 5\), what is \(\gcd(a, b)\)?

Question 4 of 5

To test whether \(n = 113\) is prime by trial division, what is the largest prime you need to check?

Question 5 of 5

Which statement best describes the Fundamental Theorem of Arithmetic?