Home / Math / Prime Factorization Calculator

Prime Factorization Calculator

Enter a whole number from 2 to 1,000,000,000,000 and see it written as a product of primes, together with how many divisors it has, their sum and, for smaller numbers, the full list.

By Adzita Editorial Team · Updated 2026-11-03 · How we build and check our tools

A whole number from 2 up to 1,000,000,000,000.

How the factorization is found

The fundamental theorem of arithmetic says every whole number greater than 1 is either prime or can be written as a product of primes in exactly one way, apart from the order of the factors. This page finds that product by trial division. It divides out every factor of 2 first, then tries the odd numbers 3, 5, 7 and so on, dividing each one out as many times as it fits.

The search only has to run while the trial divisor squared is no larger than what remains. If a number has a factor bigger than its square root, the matching cofactor is smaller than the square root and would already have been found. Whatever is left above 1 at the end must itself be prime. For a number near one trillion that means at most about half a million trial divisions, which a browser finishes almost instantly.

Counting and summing divisors from the exponents

Once the number is written as pa × qb × rc …, its divisors can be counted without listing them. Each divisor chooses an exponent for every prime from zero up to that prime's own exponent, so the count is (a + 1)(b + 1)(c + 1) …. For 360 = 23 × 32 × 5 the count is 4 × 3 × 2 = 24.

The sum of the divisors multiplies the matching geometric sums: (1 + p + … + pa)(1 + q + … + qb) …. For 360 that is 15 × 13 × 6 = 1,170. A number is a perfect square exactly when every exponent is even, which is also exactly when it has an odd number of divisors.

What prime factors are used for

Limits and common mistakes

The number 1 is not prime and has no prime factorization, because counting it would break the uniqueness in the theorem above. Every factor in the output is prime, so a composite such as 4 or 6 never appears as a factor. Write repeated primes as exponents: 2 × 2 × 2 is 23.

This page accepts whole numbers up to 1012, where trial division is quick and every intermediate value is exact in standard double-precision arithmetic. Factoring very large numbers is a hard problem in general, which is why public-key cryptography relies on products of two huge primes. For a number with hundreds of digits, specialised software and far more time are needed.

Worked example

Factor 360, a number with many divisors, and see how the exponents determine how many divisors it has.

Inputs

Whole number to factor360

Result

360 = 2^3 × 3^2 × 5

The largest prime factor is 5.

Prime factorization2^3 × 3^2 × 5
Distinct prime factors3
Prime factors counted with repeats6
Number of divisors24
Sum of divisors1,170
Perfect squareNo
All divisors1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, 360

Prime factor table

PrimeExponentPrime power
238
329
515

Accuracy note: Results use standard double-precision arithmetic, so very large or very small values may be rounded. Check important results by another method.

Frequently asked questions

What is prime factorization?

It is writing a whole number greater than 1 as a product of prime numbers. For example, 360 equals 2 × 2 × 2 × 3 × 3 × 5, which is written 2^3 × 3^2 × 5.

Is the prime factorization of a number unique?

Yes. Apart from the order of the factors, every whole number greater than 1 has exactly one prime factorization. This is the fundamental theorem of arithmetic.

How many divisors does a number have?

Add one to each exponent in the prime factorization and multiply the results. For 360 with exponents 3, 2 and 1, the count is 4 × 3 × 2 = 24 divisors.

Why is 1 not a prime number?

A prime must have exactly two distinct divisors, and 1 has only one. Treating 1 as prime would also destroy the uniqueness of factorization, since extra factors of 1 could be added freely.

What is the largest number this calculator can factor?

It accepts whole numbers up to 1,000,000,000,000. Within that range trial division is fast and every value is represented exactly by the browser.

Prime Number CheckerTest whether a whole number up to 19 digits is prime, with smallest factor and neighbouring primes.GCF CalculatorGreatest common factor (GCD) of two or more whole numbers, with Euclidean algorithm steps.LCM CalculatorLeast common multiple of two or more whole numbers, with prime factors and the matching GCF.Square Root CalculatorSquare, cube and nth roots with simplified radical form and perfect-power check.

References and sources

  1. Hardy, G. H. and Wright, E. M., An Introduction to the Theory of Numbers: the fundamental theorem of arithmetic and divisor functions.
  2. Euclid, Elements Book VII and IX: early statements of factorization into primes.

Check primary sources for anything you rely on.