Prime Factorization Calculator

Instantly decompose any positive integer into its unique prime factors according to the Fundamental Theorem of Arithmetic. View factorized form with exponents, prime factor list, and detailed mathematical background.

Supported range: 1 to 9,007,199,254,740,991 (Number.MAX_SAFE_INTEGER).
Try examples:
24 = 2³×3
100 = 2²×5²
256 = 2⁸
997 (prime)
999983 (large prime)
123456
1 (unit)
Privacy-first: All calculations are performed locally in your browser. No data is sent to any server.

Fundamental Theorem of Arithmetic: The Unique Prime Factorization

The Fundamental Theorem of Arithmetic states that every integer greater than 1 is either a prime number itself or can be represented as a unique product of prime numbers, up to the order of the factors. This theorem is the cornerstone of number theory and underpins many modern cryptographic systems, including RSA encryption. Our prime factorization calculator instantly finds the unique prime decomposition using an optimized trial division algorithm.

If \( n > 1 \), then \( n = p_1^{e_1} \times p_2^{e_2} \times \dots \times p_k^{e_k} \)

where \( p_i \) are distinct primes and \( e_i \) are positive integers.

Why Prime Factorization Matters

  • Cryptography: RSA encryption relies on the difficulty of factoring large semiprime numbers.
  • Number Theory: GCD & LCM calculations become trivial when prime factorizations are known.
  • Simplifying Fractions: Cancel common prime factors between numerator and denominator.
  • Combinatorics & Algebra: Prime exponents appear in divisor functions, perfect numbers, and polynomial factorization.
  • Real-world algorithms: Hash table sizing, checksums, and pseudorandom number generators use primes.

How Our Algorithm Works

Computational method: We first handle divisibility by 2, then iterate through odd divisors from 3 up to √n. For each divisor that divides n, we extract all occurrences and record the exponent. This yields the full prime factorization with exponential notation. The algorithm is efficient for numbers up to 9 quadrillion (2^53-1) and runs in milliseconds.

Step-by-Step Factorization Example

Example: Factorize 360.
Step 1: Divide by 2 → 360 = 2 × 180.
Step 2: 180 = 2 × 90 → 360 = 2² × 90.
Step 3: 90 = 2 × 45 → 360 = 2³ × 45.
Step 4: 45 is odd, test next prime 3 → 45 = 3 × 15 → 360 = 2³ × 3 × 15.
Step 5: 15 = 3 × 5 → 360 = 2³ × 3² × 5.
Final prime factorization: 2³ × 3² × 5.

Applications Across Disciplines

Case Study: RSA Cryptography

RSA encryption security is based on the fact that multiplying two large primes (each hundreds of digits) is computationally easy, but factoring the resulting product back into its prime factors is extremely hard. The difficulty of prime factorization for semiprime numbers with 2048 bits ensures secure internet communications. While our calculator handles smaller integers, the same mathematical principle demonstrates why factorization is a one-way function for large keys. Leading researchers like Rivest, Shamir, and Adleman leveraged the Fundamental Theorem for modern public-key cryptography.

Educational Context: Least Common Multiple (LCM) & Greatest Common Divisor (GCD)

Using prime factorizations, LCM is obtained by taking the highest exponent of each prime, and GCD by taking the lowest exponent. For example, 12 = 2²×3 and 18 = 2×3² → GCD = 2¹×3¹ = 6, LCM = 2²×3² = 36. This method is taught worldwide in middle and high school mathematics and builds intuition for divisibility rules.

Frequently Asked Questions

The number 1 has no prime factors. It is the multiplicative identity and is neither prime nor composite. Our calculator returns a special message: "1 has no prime factors."

Our calculator uses exact integer arithmetic and works flawlessly for all integers up to Number.MAX_SAFE_INTEGER (9,007,199,254,740,991). Beyond that, JavaScript loses integer precision, so we restrict input to that limit. Results are mathematically exact.

The Fundamental Theorem applies to integers greater than 1. For zero and negative integers, prime factorization is not defined. The calculator will display an appropriate warning. Only positive integers ≥ 2 are factorized; 1 is treated specially.

Using exponents (e.g., 2³ instead of 2×2×2) makes the representation compact and clearer, especially for numbers with repeated prime factors. It also directly shows the exponent value, which is essential for calculating divisor counts, Euler's totient, etc.

Since our maximum safe integer is ~9×10¹⁵, the largest possible prime factor is the number itself if it is prime (e.g., 999983, 9007199254740881). The algorithm efficiently handles primality checks using trial division up to √n.

Historical Perspective & Mathematicians

Euclid first proved the existence of infinite primes, but the Fundamental Theorem of Arithmetic was rigorously proved by Carl Friedrich Gauss in his 1801 work "Disquisitiones Arithmeticae". The theorem ensures the uniqueness of prime factorization, which later influenced the development of algebraic number theory. Mathematicians like Leonhard Euler and Bernhard Riemann further expanded prime distribution studies. Our interactive tool honors this legacy by making prime decomposition accessible to everyone.

This prime factorization tool is built upon rigorous number theory principles, referenced from standard textbooks: Rosen's "Elementary Number Theory", Hardy & Wright's "An Introduction to the Theory of Numbers", and resources from Wolfram MathWorld. Reviewed by the GetZenQuery Tech team, April 2026.

Number Prime Factorization Number of Prime Factors (with multiplicity) Distinct Primes
60 2² × 3 × 5 4 3
97 Prime 1 1
1024 2¹⁰ 10 1
2024 2³ × 11 × 23 5 3
99991 Prime (99991) 1 1