Prime Factorization Calculator
Find the prime factors of any number. Displays the prime factorization with exponents. Try this free online math calculator for instant, accurate results.
What Is Prime Factorization?
Prime factorization is the process of breaking a composite number down into its unique set of prime building blocks. A prime number is a natural number greater than 1 that is divisible only by 1 and itself — for example, 2, 3, 5, 7, 11, 13, 17, 19, 23. A composite number is any integer greater than 1 that is not prime — meaning it has at least one factor other than 1 and itself.
When we prime factorize a number like 360, we express it as a product of primes: 360 = 2³ × 3² × 5. This representation is unique for every integer — a result enshrined in the Fundamental Theorem of Arithmetic, which states that every integer greater than 1 is either prime itself or can be represented as a unique product of prime numbers (disregarding the order of factors).
The concept has been studied for over 2,000 years. Euclid's Elements (circa 300 BCE) contains both a proof of the infinitude of primes and the earliest form of the fundamental theorem, making prime factorization one of the oldest continuously studied problems in mathematics.
The Fundamental Theorem of Arithmetic
The Fundamental Theorem of Arithmetic is the cornerstone of number theory. It has two parts: first, every integer greater than 1 can be expressed as a product of primes; second, this representation is unique (up to the order of factors). For instance, 12 = 2² × 3, and no matter what approach you take, you will always arrive at exactly those prime factors with exactly those exponents.
This uniqueness is what makes prime factorization so powerful. Without it, arithmetic operations like finding GCD and LCM, simplifying fractions, or proving divisibility properties would be far more complex. The theorem underpins virtually all of elementary and intermediate number theory.
An interesting consequence: if you want to know whether an integer n divides an integer m, you can compare their prime factorizations. n divides m if and only if every prime that appears in the factorization of n also appears in the factorization of m with at least as high an exponent.
How to Find Prime Factors: Step-by-Step Methods
There are two main manual methods for prime factorization: the factor tree and repeated division.
Factor Tree Method: Write the number at the top and branch it into any two factors. Continue branching each composite factor until all branches end in prime numbers. For 180: branch into 4 and 45 → branch 4 into 2 and 2 → branch 45 into 9 and 5 → branch 9 into 3 and 3. Collect all leaf nodes: 2 × 2 × 3 × 3 × 5 = 2² × 3² × 5.
Repeated Division Method: Divide the number by the smallest prime that divides it evenly, then divide the quotient by the smallest prime that divides it, and so on. For 360: 360 ÷ 2 = 180 → 180 ÷ 2 = 90 → 90 ÷ 2 = 45 → 45 ÷ 3 = 15 → 15 ÷ 3 = 5 → 5 is prime. Result: 2³ × 3² × 5.
Key shortcut: You only need to test prime divisors up to the square root of the number. If no prime up to √n divides n, then n itself is prime. For n = 97, √97 ≈ 9.85, so you only need to test 2, 3, 5, 7. Since none of them divide 97, it is prime. This reduces work dramatically for large numbers.
Prime Factorization Reference Table
Below is a reference table showing the prime factorizations of common integers:
| Number | Prime Factorization | Number of Factors |
|---|---|---|
| 12 | 2² × 3 | 6 |
| 24 | 2³ × 3 | 8 |
| 36 | 2² × 3² | 9 |
| 48 | 2⁴ × 3 | 10 |
| 60 | 2² × 3 × 5 | 12 |
| 72 | 2³ × 3² | 12 |
| 100 | 2² × 5² | 9 |
| 120 | 2³ × 3 × 5 | 16 |
| 180 | 2² × 3² × 5 | 18 |
| 360 | 2³ × 3² × 5 | 24 |
The number of factors formula: if n = p₁^a × p₂^b × p₃^c…, then the total count of factors is (a+1)(b+1)(c+1)… For 360 = 2³ × 3² × 5¹: factors = (3+1)(2+1)(1+1) = 4 × 3 × 2 = 24.
Applications of Prime Factorization
Greatest Common Divisor (GCD): To find GCD(48, 180), factorize both — 48 = 2⁴ × 3, 180 = 2² × 3² × 5 — then take the minimum exponent of each common prime: GCD = 2² × 3 = 12. The GCD is used to simplify fractions: 48/180 = 4/15 (divide both by 12).
Least Common Multiple (LCM): Take the maximum exponent of each prime across both factorizations. LCM(48, 180) = 2⁴ × 3² × 5 = 720. LCM is used when adding fractions with different denominators — you need a common denominator, which is LCM(denominator₁, denominator₂).
Cryptography (RSA): The difficulty of factoring large numbers — specifically the product of two large primes — is the mathematical foundation of RSA encryption. RSA-2048 uses a public key that is the product of two 1024-bit primes. Factoring it would take longer than the age of the universe with current algorithms. This security underpins HTTPS, email encryption, and digital signatures.
Simplifying Expressions: In algebra, factoring polynomials shares conceptual similarities with integer factorization. Just as 12 = 4 × 3 = 2² × 3, the expression x² − 9 factors as (x−3)(x+3). The prime factorization mindset transfers directly to algebraic manipulation.
Prime Numbers and Their Distribution
The primes themselves are endlessly fascinating. The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 ... As numbers get larger, primes become less frequent, but they never stop appearing. Euclid proved this over 2,300 years ago with a brilliantly simple proof by contradiction.
The Prime Number Theorem (proved independently by Hadamard and de la Vallée Poussin in 1896) states that the number of primes up to n is approximately n / ln(n). This means roughly 1 in every ln(n) integers near n is prime — so near 1 million, about 1 in 14 numbers is prime; near 1 billion, about 1 in 21.
Special categories of primes include: twin primes (pairs differing by 2: 11 & 13, 17 & 19), Mersenne primes (of the form 2^p − 1; the largest known prime as of 2024 is a Mersenne prime with over 41 million digits), and Sophie Germain primes (p where 2p+1 is also prime). Whether infinitely many twin primes exist is an open problem — the Twin Prime Conjecture.
| Prime Type | Definition | Examples |
|---|---|---|
| Twin Primes | Differ by 2 | (3,5), (11,13), (17,19), (29,31) |
| Mersenne Primes | 2^p − 1 where p is prime | 7, 31, 127, 8191 |
| Sophie Germain | p and 2p+1 are both prime | 2, 3, 5, 11, 23 |
| Safe Primes | Of form 2p+1 where p is Sophie Germain | 5, 7, 11, 23, 47 |
| Palindromic Primes | Same digits forwards and backwards | 11, 101, 131, 151 |
Factorization Algorithms: From Trial Division to Advanced Methods
For small numbers (under a billion), trial division is fast and straightforward: try dividing by 2, then all odd numbers up to √n. Our calculator uses this approach and handles numbers up to tens of billions in milliseconds.
For larger numbers, mathematicians have developed more sophisticated algorithms. Fermat's factorization method works by expressing n as a difference of two squares: n = a² − b² = (a+b)(a−b). Pollard's rho algorithm (1975) is a probabilistic method efficient for numbers with small factors; it runs in O(n^(1/4)) time and is used in many real-world applications.
The most powerful known general-purpose factoring algorithm is the General Number Field Sieve (GNFS), which has sub-exponential running time. GNFS was used to factor RSA-768 (a 768-bit RSA challenge number) in 2009, requiring the equivalent of 2,000 years of single-core CPU time distributed across many computers. RSA-2048 is considered computationally infeasible to factor with classical computers.
Quantum computers could theoretically factor large numbers efficiently using Shor's Algorithm (1994), which runs in polynomial time. This is why post-quantum cryptography — developing encryption that resists quantum attacks — is a major area of research today.
Prime Factorization in Education and Competitive Math
Prime factorization is a core skill in middle school and high school mathematics. It enables students to simplify fractions, find GCD and LCM, work with perfect squares and perfect cubes, and understand divisibility rules. Mastering factorization also builds intuition for algebra, where factoring polynomials is a similar skill applied to expressions instead of integers.
In competitive mathematics (AMC, AIME, Olympiads), prime factorization problems frequently appear. A classic example: "How many positive integer divisors does 1,000,000 have?" Since 1,000,000 = 10⁶ = (2 × 5)⁶ = 2⁶ × 5⁶, the answer is (6+1)(6+1) = 49. These types of problems reward students who think multiplicatively rather than additively.
Understanding exponents in prime factorizations also unlocks concepts like perfect squares (all exponents even), perfect cubes (all exponents divisible by 3), and the smallest perfect square that is a multiple of a given number — all common exam topics.
Frequently Asked Questions
Is 1 a prime number?
No. By convention, 1 is neither prime nor composite. Including 1 as prime would break the uniqueness of prime factorization (6 = 2 × 3 = 1 × 2 × 3 = 1² × 2 × 3, etc., yielding infinitely many "factorizations"). The definition of prime requires a number to have exactly two distinct positive divisors, and 1 has only one.
What is the prime factorization of a prime number?
A prime number's only prime factorization is itself. The prime factorization of 17 is just 17¹ = 17. By the Fundamental Theorem of Arithmetic, primes are the indivisible building blocks — they cannot be broken down further.
How is prime factorization used in encryption?
RSA encryption relies on the computational asymmetry between multiplication and factorization. Multiplying two 1024-bit primes takes microseconds; factoring their 2048-bit product is computationally infeasible with classical computers. This one-way trapdoor is the security basis for most of today's internet encryption.
What is the largest known prime number?
As of 2024, the largest known prime is a Mersenne prime: 2^136,279,841 − 1, discovered in October 2024. It has over 41 million digits. Mersenne primes are found using the GIMPS (Great Internet Mersenne Prime Search) distributed computing project.
How do I find the GCD using prime factorization?
Factorize both numbers, then multiply together the lowest power of each common prime factor. GCD(60, 90): 60 = 2² × 3 × 5, 90 = 2 × 3² × 5. Common primes: 2, 3, 5. GCD = 2¹ × 3¹ × 5¹ = 30.
How do I find the LCM using prime factorization?
Factorize both numbers, then multiply together the highest power of each prime that appears in either factorization. LCM(12, 18): 12 = 2² × 3, 18 = 2 × 3². LCM = 2² × 3² = 36. This is the smallest number divisible by both 12 and 18.
Can every even number be expressed as a sum of two primes?
This is the famous Goldbach's Conjecture (1742), one of the most famous unsolved problems in mathematics. It has been verified for all even numbers up to 4 × 10¹⁸ but has never been proven for all even numbers. Most mathematicians believe it is true.
How many prime numbers are there?
Infinitely many. Euclid's proof (circa 300 BCE): assume a finite list of primes p₁, p₂, …, pₙ. The number (p₁ × p₂ × … × pₙ) + 1 is either prime itself or has a prime factor not in the original list — contradiction. Therefore the list can never be complete.
What is a semiprime?
A semiprime is a natural number that is the product of exactly two prime numbers (not necessarily distinct). Examples: 4 (= 2×2), 6 (= 2×3), 9 (= 3×3), 15 (= 3×5). Semiprimes are important in cryptography — RSA public keys are semiprimes, the product of two large primes.
Why do we only need to check primes up to the square root?
If n has a factor greater than √n, it must also have a corresponding factor less than √n (since their product is n). So once you've tested all primes up to √n and found none divide n, you've proven n is prime. For n = 101: √101 ≈ 10.05, so test 2, 3, 5, 7. None divide 101, so 101 is prime.
Using Prime Factorization to Simplify Fractions and Radicals
Prime factorization is the most systematic method for simplifying fractions. To simplify 84/126, factorize both: 84 = 2² × 3 × 7 and 126 = 2 × 3² × 7. GCD = 2 × 3 × 7 = 42. So 84/126 = (84÷42)/(126÷42) = 2/3. No guessing required — the prime factorizations reveal the GCD directly.
For simplifying radicals, prime factorization is equally powerful. To simplify √180: 180 = 2² × 3² × 5. Pairs of primes come out of the square root: √(2² × 3² × 5) = 2 × 3 × √5 = 6√5. For cube roots: ∛(108) = ∛(2² × 3³) = 3∛4. Groups of three come out of the cube root.
In competitive math, these techniques frequently appear. A common problem type: "Find the smallest integer n such that 360n is a perfect square." Since 360 = 2³ × 3² × 5, we need all exponents to be even. Currently 2 has exponent 3 (odd) and 5 has exponent 1 (odd). So n must supply at least 2¹ × 5¹ = 10. Answer: n = 10. Check: 360 × 10 = 3600 = 60². ✓
Number of Divisors, Perfect Numbers, and Sum of Divisors
Prime factorization unlocks the complete analysis of a number's divisors. If n = p₁^a × p₂^b × p₃^c, then the number of divisors is τ(n) = (a+1)(b+1)(c+1). The sum of divisors is σ(n) = ((p₁^(a+1)−1)/(p₁−1)) × ((p₂^(b+1)−1)/(p₂−1)) × ...
For 12 = 2² × 3: τ(12) = (2+1)(1+1) = 6 (divisors: 1,2,3,4,6,12). σ(12) = ((2³−1)/(2−1)) × ((3²−1)/(3−1)) = 7 × 4 = 28. A perfect number equals the sum of its proper divisors (divisors excluding itself). σ(n) − n = n → σ(n) = 2n. For 6 = 2 × 3: σ(6) = 12 = 2×6. ✓ 6 is perfect! For 28 = 2² × 7: σ(28) = 56 = 2×28. ✓ 28 is perfect!
Only 51 perfect numbers are known as of 2024, all even, all of the form 2^(p−1)(2^p−1) where 2^p−1 is a Mersenne prime. Whether any odd perfect numbers exist is one of the oldest open problems in mathematics — no odd perfect number has been found, but none has been proven impossible.
Quick Reference: Divisibility Rules
Before factorizing, divisibility rules help identify factors quickly without doing full division. These mental shortcuts are essential for efficient manual factorization and exam settings.
| Divisor | Rule | Example |
|---|---|---|
| 2 | Last digit is even (0,2,4,6,8) | 348 is divisible by 2 |
| 3 | Sum of digits is divisible by 3 | 372: 3+7+2=12 → divisible by 3 |
| 4 | Last 2 digits divisible by 4 | 3,724: 24÷4=6 ✓ |
| 5 | Last digit is 0 or 5 | 1,235 is divisible by 5 |
| 6 | Divisible by both 2 and 3 | 372: even AND digit sum=12 ✓ |
| 7 | Double last digit, subtract from rest; repeat | 343: 34−(2×3)=28, 28÷7=4 ✓ |
| 8 | Last 3 digits divisible by 8 | 3,120: 120÷8=15 ✓ |
| 9 | Sum of digits divisible by 9 | 729: 7+2+9=18 ✓ |
| 11 | Alternating digit sum divisible by 11 | 1,331: 1−3+3−1=0 ✓ |
Memorizing these rules makes prime factorization significantly faster. For 2,520: it's even (÷2), digit sum=9 (÷3), ends in 0 (÷5). Starting with 2: 2520÷2=1260÷2=630÷2=315÷3=105÷3=35÷5=7. So 2520 = 2³ × 3² × 5 × 7 — a highly composite number with 48 divisors.