🔢 Prime Factorization Calculator – Break Any Integer Into Its Primes
The Prime Factorization Calculator decomposes any positive integer into its unique set of prime building blocks. Enter a number, choose an optional input base, and instantly receive the canonical prime power notation (e.g., 360 = 2³ × 3² × 5), a full step-by-step division log, and advanced divisor statistics — all in one place.
What Is Prime Factorization?
Every integer greater than 1 can be written as a product of prime numbers in exactly one way — a principle called the Fundamental Theorem of Arithmetic. For example:
360 = 2 × 2 × 2 × 3 × 3 × 5
= 2³ × 3² × 5
84 = 2² × 3 × 7
97 = 97¹ (prime)The factorization is always written with primes in ascending order. If the input number is already prime, the result is simply p¹.
How the Calculation Works
The tool uses trial division with BigInt arithmetic:
- Divide repeatedly by 2 while the number is even.
- Test odd divisors 3, 5, 7 … up to √n.
- Each time a divisor divides evenly, record it and continue with the quotient.
- If the remaining value is greater than 1, it is the final prime factor.
Using BigInt means the calculator handles numbers far beyond JavaScript's safe integer limit without precision loss.
Key Outputs Explained
| Output | Example (n = 360) | Formula |
|---|---|---|
| Prime Power Notation | 2³ × 3² × 5 | Canonical form |
| Expanded List | 2, 2, 2, 3, 3, 5 | All factors with repetition |
| Divisor Count | 24 | ∏ (eᵢ + 1) |
| Divisor Sum | 1170 | ∏ (pᵢ^(eᵢ+1) − 1) / (pᵢ − 1) |
| Largest Prime Factor | 5 | Max prime in the factorization |
Divisor Count and Divisor Sum Formulas
If n = p₁^a₁ × p₂^a₂ × … × pₖ^aₖ, then:
- Divisor count
d(n) = (a₁ + 1)(a₂ + 1)…(aₖ + 1)— counts every positive divisor of n. - Divisor sum
σ(n) = ∏ [(pᵢ^(aᵢ+1) − 1) / (pᵢ − 1)]— sums every positive divisor of n.
These values are useful in number theory, perfect number analysis, and cryptographic primality testing.
Input Base Support
The calculator accepts numbers in decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). This is useful when working with binary data, memory addresses, or color codes that you want to factor in decimal.
Batch Factorization Mode
Switch to Batch Mode to factor several integers at once. Enter numbers separated by commas or new lines (e.g., 84, 90, 97, 360). The tool produces a result table with the factorization and divisor data for each entry.
Special Cases
- n = 1 — The number 1 has no prime factors. It is neither prime nor composite. Its divisor count is 1 and its divisor sum is 1.
- Prime inputs — Reported as prime with factorization p¹. Divisor count = 2, divisor sum = 1 + p.
- Powers of a single prime — e.g., 128 = 2⁷. Only one prime factor appears.
Practical Applications
Prime factorization is the foundation of many mathematical and computational tasks:
- GCD and LCM — The greatest common divisor and least common multiple of two numbers can be read directly from their shared prime factors.
- Fraction simplification — Factor the numerator and denominator, then cancel common primes.
- Cryptography — RSA encryption relies on the computational difficulty of factoring large semi-prime numbers.
- Perfect and abundant numbers — Use divisor sum σ(n) to classify integers.
All calculations use BigInt arithmetic and run entirely in your browser. No data is sent to a server.