Math

Prime Factorization Calculator

Break down any number into its prime factors with step-by-step division. Shows the full factorization tree. Free — no sign-up needed.

Did this calculator help you?

What is Prime Factorization Calculator?

Prime factorization is one of the most fundamental concepts in number theory — the mathematical study of integers and their properties. The Fundamental Theorem of Arithmetic states that every integer greater than 1 can be expressed as a unique product of prime numbers. This uniqueness makes prime factorization indispensable across mathematics and computer science. This calculator uses trial division — testing divisibility by each prime starting from 2 — to systematically find all prime factors. The result is displayed in exponential form and as a complete step-by-step division walkthrough. In the digital age, prime factorization has taken on critical importance in cryptography. The RSA algorithm — which secures most internet communications — relies on the mathematical fact that while multiplying two large primes is trivial, factoring their product is computationally infeasible for large enough numbers.

When to Use This Calculator

  • Simplifying fractions: find prime factors of numerator and denominator to reduce to lowest terms
  • Computing GCD and LCM using prime factor lists instead of the Euclidean algorithm
  • RSA cryptography: understanding how large prime factors protect encrypted communications
  • Mathematics competitions: solving number theory problems involving divisibility and factorization
  • Algebraic factoring: extending prime factorization concepts to polynomial expressions
  • Understanding perfect, abundant, and deficient numbers through their divisor structure

Steps:

  1. Enter any positive integer from 2 to 10,000,000.
  2. The algorithm starts by dividing by 2, the smallest prime.
  3. Each time the number divides evenly, the divisor is recorded as a factor.
  4. When 2 no longer divides evenly, the algorithm tries 3, 5, 7, 11, ...
  5. This continues until the remaining number equals 1 or is itself prime.
  6. The factorization is written in exponential form: n = p₁^a₁ × p₂^a₂ × ...
  7. Divisors are counted using the formula τ(n) = (a₁+1)(a₂+1)···(aₖ+1).

Formula

Every integer n > 1 can be uniquely written as: n = p₁^a₁ × p₂^a₂ × ··· × pₖ^aₖ where p₁ < p₂ < ··· < pₖ are distinct primes and a₁, a₂, ..., aₖ ≥ 1. Number of divisors: τ(n) = (a₁+1)(a₂+1)···(aₖ+1)

Use Cases

  • Simplifying fractions to lowest terms
  • Finding GCD and LCM of numbers
  • RSA encryption and public-key cryptography
  • Solving number theory problems in mathematics competitions
  • Understanding divisibility rules in mathematics
  • Algebraic factoring and polynomial simplification

Key Benefits

  • Instantly decompose any number up to 10,000,000 into its prime factors with full step-by-step breakdown
  • See the factorization in exponential form: 360 = 2³ × 3² × 5¹ for easy reading
  • Automatically count all divisors using the divisor function formula τ(n) = (a₁+1)(a₂+1)...
  • Identify whether a number is prime or composite with immediate result
  • Understand the Fundamental Theorem of Arithmetic through worked examples
  • Apply results to GCD, LCM, fraction simplification, and cryptography problems

Pro Tips

  • Only test prime divisors up to √n — if n has no factors up to its square root, then n is prime
  • Start with 2 (the only even prime), then test odd numbers: 3, 5, 7, 11, 13...
  • Use the divisor count formula: if n = p₁^a₁ × p₂^a₂, then τ(n) = (a₁+1)(a₂+1)
  • For very large numbers, prime factorization becomes computationally expensive — this is the basis of RSA security
  • Remember that 1 has no prime factors and is neither prime nor composite
  • Check your work: multiply all prime factors (with exponents) back together to verify you get the original number

Common Mistakes to Avoid

  • Forgetting that 1 is not a prime number — it has no prime factors and is classified as neither prime nor composite
  • Stopping too early: if the remaining number after division is greater than 1, it is also a prime factor
  • Confusing prime factorization with listing all factors — factorization expresses the number as a PRODUCT of primes
  • Assuming all odd numbers are prime: 9 = 3², 15 = 3×5, 21 = 3×7 are all composite
  • Not using exponential form: writing 2×2×2×3×3×5 instead of 2³×3²×5 is harder to read and compare
  • Forgetting that the order of prime factors does not matter: 2³×3²×5 = 5×3²×2³ = 2³×5×3²

Key Terms Explained

Prime number: An integer > 1 with no factors other than 1 and itself
Composite number: An integer > 1 that is not prime
Fundamental Theorem of Arithmetic: Every integer > 1 has a unique prime factorization
Trial division: Factorization algorithm testing divisibility by successive primes
Exponent: In p^a, the exponent a counts how many times prime p appears
Divisor function τ(n): Counts the total number of positive divisors of n

Related Concepts

  • GCD and LCM Calculator: Use prime factorization to compute GCD and LCM through prime factor lists.
  • Logarithm Calculator: Explore the logarithmic complexity of factorization algorithms.
  • Percentage Calculator: Analyze the proportion of each prime factor in the factorization.
  • Fraction Calculator: Simplify fractions using prime factorization for numerator and denominator.
  • Exponents Calculator: Work with the exponential form of prime factorizations.

Example

Factorize 360: 360÷2=180 → 180÷2=90 → 90÷2=45 → 45÷3=15 → 15÷3=5 → 5 is prime. Result: 360 = 2³ × 3² × 5¹. Divisors: (3+1)(2+1)(1+1) = 24.

Interpreting Your Results

The factorization result shows the unique prime decomposition of your number. Each prime factor raised to its exponent tells you how many times that prime divides the number. For example, 360 = 2³ × 3² × 5 means 360 is divisible by 2 three times, by 3 twice, and by 5 once. The exponent structure reveals properties: (a₁+1)(a₂+1)... gives the total divisor count; the sum of exponents gives the total number of prime factors (with multiplicity); and the number of distinct prime factors is the count of different primes in the factorization.

Frequently Asked Questions

What is prime factorization?
Prime factorization expresses a number as a product of its prime factors. Every integer greater than 1 has a unique prime factorization — the Fundamental Theorem of Arithmetic. Example: 360 = 2³ × 3² × 5. This uniqueness makes it invaluable across mathematics and computer science.
What is a prime number?
A prime number is a natural number greater than 1 with no positive divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23... There are infinitely many primes — Euclid proved this around 300 BC. The number 2 is the only even prime.
How is prime factorization used in real life?
Prime factorization is the foundation of RSA cryptography, which secures most internet communications. It is also used for simplifying fractions, computing GCD and LCM, solving competition math problems, and understanding divisibility rules.
How do I count divisors from prime factorization?
If n = p₁^a₁ × p₂^a₂ × ... × pₖ^aₖ, then the number of positive divisors is (a₁+1)(a₂+1)···(aₖ+1). Example: 12 = 2² × 3¹ has (2+1)(1+1) = 6 divisors: 1, 2, 3, 4, 6, 12.
Why is factoring large numbers hard?
While multiplying two large primes is easy (computer can do it in milliseconds), factoring their product back into those primes is computationally infeasible for numbers with hundreds of digits. This asymmetry is the basis of RSA encryption — the trapdoor function that protects internet traffic.
What is the Sieve of Eratosthenes?
The Sieve of Eratosthenes is an ancient algorithm (circa 240 BC) for finding all primes up to a given limit. It works by iteratively marking the multiples of each prime starting from 2. It is efficient and simple — one of the oldest algorithms still taught in schools.
How do I find prime factors quickly?
Start with the smallest prime (2) and divide repeatedly until it no longer divides evenly. Then try 3, 5, 7, 11, and so on. You only need to test primes up to √n because if n has a factor larger than √n, it must also have one smaller than √n.
What is the sum of divisors function?
The sum of divisors σ(n) = (p₁^(a₁+1)−1)/(p₁−1) × ... × (pₖ^(aₖ+1)−1)/(pₖ−1). For example, σ(12) = σ(2²×3) = (2³−1)/(2−1) × (3²−1)/(3−1) = 7×4 = 28. Perfect numbers satisfy σ(n) = 2n.
What are abundant and deficient numbers?
A number is abundant if σ(n) > 2n (sum of divisors exceeds twice the number), deficient if σ(n) < 2n, and perfect if σ(n) = 2n. 12 is abundant: its divisors 1+2+3+4+6+12 = 28 > 24. Perfect numbers (6, 28, 496) are rare and studied since antiquity.
How is prime factorization used in GCD and LCM?
GCD(a,b) = product of common prime factors raised to their lowest powers. LCM(a,b) = product of all prime factors raised to their highest powers. Example: 12 = 2²×3 and 18 = 2×3². GCD = 2×3 = 6. LCM = 2²×3² = 36.
What is the largest prime factorization you can compute?
Our calculator handles numbers up to 10,000,000. For larger numbers, specialized algorithms like the quadratic sieve or general number field sieve are used. The largest factorized number as of 2024 is RSA-250 (829 bits), which required thousands of CPU-years.

Discover More Tools

Fresh picks from across our tool library.