Prime Factorization Calculator
Break any whole number into its prime building blocks and go deeper. Enter an integer to get its prime factorization in exponent form, the complete list of all its divisors, the divisor count and sum, Euler's totient, and a classification as prime, perfect, abundant, or deficient.
Formula
Worked example
Factor 360: divide by 2 three times (360 -> 180 -> 90 -> 45), then by 3 twice (45 -> 15 -> 5), then 5 is prime. So 360 = 2^3 x 3^2 x 5. Divisors: tau(360) = (3+1)(2+1)(1+1) = 24. Sum of divisors: sigma(360) = (1+2+4+8)(1+3+9)(1+5) = 15 x 13 x 6 = 1170. Totient: phi(360) = 4 x 1 x 6 x 2 x 4 x 1 = 96.
What prime factorization is and why it matters
Prime factorization expresses a whole number as a product of prime numbers: numbers like 2, 3, 5, and 7 that divide evenly only by 1 and themselves. The Fundamental Theorem of Arithmetic guarantees that every integer greater than 1 has exactly one such factorization, regardless of the order of the factors. Writing repeated primes with exponents, such as 2^3 instead of 2 x 2 x 2, keeps the answer compact. The factorization is the master key for number theory: it lets you compute greatest common divisors, least common multiples, simplify fractions, reduce radicals, and is the hard mathematical problem underlying RSA public-key cryptography.
How the calculator finds the factors
This tool uses trial division, the most transparent method. It repeatedly tests whether the smallest prime (2) divides the number evenly, records it, then shrinks the number and moves on to the next candidate. Because only odd numbers beyond 2 can be prime, the loop jumps by 2 after the first pass. Trial division only needs to test divisors up to the square root of the current remainder, since any factor larger than the square root would already have a matching smaller partner. Whatever number remains above 1 at the end of the loop is itself prime.
Divisor count and sum from the factorization
Once you have the factorization n = p1^a1 x p2^a2 x ... x pk^ak, three important functions follow immediately. The number of divisors tau(n) is the product of (ai + 1) for every prime, because each divisor independently chooses an exponent from 0 up to ai for each prime. The sum of divisors sigma(n) is the product of the geometric sums 1 + pi + pi^2 + ... + pi^ai for every prime. Euler's totient phi(n) counts integers from 1 to n that share no factor with n: it equals the product of pi^(ai-1) x (pi - 1) for each prime. These three functions appear throughout elementary and advanced number theory.
Perfect, abundant, and deficient numbers
Comparing sigma(n) to 2n (equivalently, comparing the sum of proper divisors to n) classifies every integer. A perfect number has sigma(n) = 2n, so its proper divisors sum to exactly n: the smallest examples are 6, 28, 496, and 8128. They are astonishingly rare. An abundant number has sigma(n) > 2n: 12 is the smallest, with proper divisors 1+2+3+4+6 = 16 > 12. A deficient number has sigma(n) < 2n: all primes and prime powers are deficient. Whether any odd perfect numbers exist is one of the oldest unsolved problems in mathematics.
Factor trees as a teaching tool
A factor tree splits a number into any two factors, then recursively splits each composite factor until only primes remain. Different trees reach the same set of primes, illustrating that the factorization is unique even if the path differs. The steps panel in this calculator walks trial division one prime at a time, which is a more systematic tree structure: always dividing out the smallest prime first guarantees the primes appear in ascending order.
Number theory classification by divisor sum
| Class | Condition | Example | Notes |
|---|---|---|---|
| Prime | Exactly 1 proper divisor (which is 1) | 7 | Only divisible by 1 and itself |
| Perfect | Sum of proper divisors = n | 6, 28, 496 | 6 = 1+2+3; very rare |
| Abundant | Sum of proper divisors > n | 12, 18, 20 | More than enough divisors |
| Deficient | Sum of proper divisors < n | 8, 9, 10 | Most composites are deficient |
How a number is classified based on the sum of its proper divisors (all divisors except itself).
Frequently asked questions
What is the prime factorization of a prime number?
A prime number is its own factorization. For example, 17 = 17, because a prime has no divisors other than 1 and itself. The calculator labels these numbers as prime and notes that their divisor count is 2, their totient is n-1, and their sum of divisors is n+1.
Why can't 0 or 1 be factored into primes?
The number 1 has no prime factors at all: it is the empty product, which equals 1. The number 0 is divisible by every integer, so it has no finite prime factorization. Prime factorization is defined only for integers greater than or equal to 2.
What do the exponents mean in an answer like 2^3 x 3^2 x 5?
The exponent counts how many times that prime appears. 2^3 means 2 x 2 x 2 = 8, and 3^2 means 3 x 3 = 9, so 2^3 x 3^2 x 5 = 8 x 9 x 5 = 360.
How do I count the number of divisors from the factorization?
Multiply (exponent + 1) for every prime in the factorization. For 360 = 2^3 x 3^2 x 5, the divisor count is (3+1)(2+1)(1+1) = 4 x 3 x 2 = 24. This works because each divisor independently picks an exponent between 0 and the prime's maximum exponent.
What is a perfect number?
A perfect number is one whose proper divisors (all divisors except itself) sum to exactly the number. The four smallest are 6, 28, 496, and 8128. Mathematically, a number is perfect when sigma(n) = 2n, where sigma is the sum of all divisors including n. It is unknown whether any odd perfect numbers exist.
What does the CSV output do?
The CSV (comma-separated values) output lists every prime factor expanded with its full multiplicity, for example 360 gives 2, 2, 2, 3, 3, 5. This format is convenient for pasting into spreadsheets or other tools that need a flat list of factors rather than exponent notation.
What is Euler's totient and why is it useful?
Euler's totient phi(n) counts how many integers from 1 to n are coprime to n (share no common factor). For a prime p, phi(p) = p-1. Totients are central to RSA encryption: the private key in RSA relies on computing phi(n) for a product of two large primes, a calculation that is easy if you know the primes but practically impossible to reverse for very large numbers.