Skip to main content
Online
Number theory · step-by-step

Prime Factorization Calculator

Enter a whole number up to 10¹⁵. You get the prime factorization by repeated division, a primality verdict, and the full list of divisors with their count and sum.

Complete guide

Prime factorization: how to factor any number, test primality and count divisors

4 min read Reviewed By the GetCalcMaster team · Editorial policy

Every whole number greater than 1 is either prime or can be written as a product of primes in exactly one way (apart from order). This is the Fundamental Theorem of Arithmetic, and the product is called the prime factorization. It underlies simplifying fractions, finding GCDs and LCMs, counting divisors and, at a much larger scale, the security of RSA encryption.

The solver uses trial division by 2, 3 and then numbers of the form 6k ± 1 up to √n, which is fast for any number up to 10¹⁵. It lists each division, gives the exponent form, and computes the number and sum of divisors.

Key formulas

Exponent form
n = p₁^e₁ · p₂^e₂ · … · p_k^e_k
360 = 2³ · 3² · 5.
Number of divisors
d(n) = (e₁ + 1)(e₂ + 1)…(e_k + 1)
360 has (3+1)(2+1)(1+1) = 24 divisors.
Sum of divisors
σ(n) = Π (p^(e+1) − 1)/(p − 1)
n is a perfect number when σ(n) = 2n (e.g. 6, 28, 496).
Trial division bound
only test primes p ≤ √n
If n had two factors both above √n their product would exceed n.

Worked examples

Example 1: Factor 360

Find the prime factorization of 360.

  1. 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45.
  2. 45 ÷ 3 = 15, ÷ 3 = 5.
  3. 5 is prime.
Answer: 360 = 2³ × 3² × 5, with 24 divisors.
Example 2: Is 9973 prime?

Test 9973.

  1. √9973 ≈ 99.86, so test primes up to 97.
  2. None divide evenly.
Answer: 9973 is prime (the largest prime below 10,000).
Example 3: A perfect number

Factor 496.

  1. 496 = 2⁴ × 31.
  2. σ = (2⁵ − 1) × (31 + 1) = 31 × 32 = 992 = 2 × 496.
Answer: 496 is a perfect number.
Example 4: Large composite

Factor 600,851,475,143.

  1. Trial division finds 71, 839, 1471 and 6857.
Answer: 600851475143 = 71 × 839 × 1471 × 6857.
Example 5: GCD and LCM from two factorizations

Use prime factorizations to find the GCD and LCM of 84 and 90.

  1. 84 = 2² × 3 × 7 and 90 = 2 × 3² × 5.
  2. GCD: take each prime the two numbers share, with the smaller exponent: 2¹ × 3¹ = 6.
  3. LCM: take every prime that appears, with the larger exponent: 2² × 3² × 5 × 7 = 1,260.
  4. Check: GCD × LCM = 6 × 1,260 = 7,560 = 84 × 90.
Answer: GCD = 6, LCM = 1,260.
Try it: 84
Example 6: Counting divisors without listing them

How many divisors does 720 have, and what is their sum?

  1. 720 = 2⁴ × 3² × 5.
  2. Each divisor picks an exponent of 2 from 0–4 (5 choices), of 3 from 0–2 (3 choices) and of 5 from 0–1 (2 choices): 5 × 3 × 2 = 30 divisors.
  3. The sum of divisors multiplies (1 + 2 + … + 2⁴) × (1 + 3 + 3²) × (1 + 5) = 31 × 13 × 6 = 2,418.
Answer: 30 divisors with a sum of 2,418.
Try it: 720

Divisibility shortcuts

Divisor Rule
2 Last digit even
3 Digit sum divisible by 3
4 Last two digits divisible by 4
5 Ends in 0 or 5
9 Digit sum divisible by 9
11 Alternating digit sum divisible by 11

Why big factorizations are hard

Multiplying two 300-digit primes takes a computer microseconds, but recovering them from the product would take the best known algorithms longer than the age of the universe. That asymmetry is what keeps RSA-encrypted web traffic secure. For the sizes here (up to 15 digits) trial division is instant.

Simplifying square roots with a factorization

Pair up equal prime factors: every pair can leave the square root as a single factor. For 720 = 2⁴ × 3² × 5, the pairs 2² × 2² and 3² give 2 × 2 × 3 = 12 outside the root, and the unpaired 5 stays inside, so √720 = 12√5 ≈ 26.83. The same idea finds the smallest number to multiply by to get a perfect square: 720 × 5 = 3,600 = 60².

Common mistakes to avoid

  • Listing a composite factor (like 9) instead of breaking it into primes (3²).
  • Stopping before the remaining quotient is prime.
  • Forgetting that 1 is not a prime number.
  • Testing divisors beyond √n unnecessarily.

Frequently asked questions

Is 1 a prime number?
No. A prime has exactly two distinct divisors, 1 and itself; 1 has only one. Excluding 1 is what makes prime factorizations unique.
What is the largest number I can factor here?
Up to 10¹⁵ (one quadrillion), which keeps every step exact in the browser.
How do prime factorizations help with fractions?
Cancel shared primes from numerator and denominator to simplify, or take the highest powers of all primes to get the least common denominator.
Why is the prime factorization of a number unique?
The fundamental theorem of arithmetic guarantees that every whole number greater than 1 can be written as a product of primes in exactly one way, apart from the order of the factors. That is why factorizations can be compared to find GCDs, LCMs and divisor counts.
How do I tell whether a number is a perfect square from its factorization?
Every exponent must be even. 3,600 = 2⁴ × 3² × 5² is a perfect square (60²); 720 = 2⁴ × 3² × 5 is not, because the exponent of 5 is odd.

Related tools and guides

Educational content. Results are computed in your browser with standard double-precision arithmetic; double-check anything with legal, financial, medical, or safety consequences. Spotted an error? Tell us and we will correct it.