Skip to main content
CalcMax

Prime Factors Calculator

Range: 1 – 1,000,000

Result

2^3 * 3^2 * 5

Prime factorization

Number of prime factors
6
Number of divisors
24

Prime factorization is writing a whole number as a product of prime numbers, using exponents to collect repeats. The primes are the numbers greater than 1 that no smaller number except 1 divides: 2, 3, 5, 7, 11, 13 and so on. Every whole number above 1 can be written this way, and there is only one way to do it, which is the fact the whole subject rests on. Twelve is 2² × 3. Three hundred and sixty is 2³ × 3² × 5, which the page prints as 2^3 * 3^2 * 5 so that the exponent is unmistakable in plain text. The page also reports two counts that are easy to confuse. The first counts prime factors with repeats included: 12 = 2 · 2 · 3 has three of them, and the count is written as the Greek capital omega. The second counts positive divisors — the numbers that divide it without a remainder: 12 has six, namely 1, 2, 3, 4, 6 and 12. For 12 those come out as 3 and 6, and neither is wrong; they are counting different things. Where the number is prime, the factorisation is just the number itself with no exponent printed, and both counts settle at their minimum: one prime factor, two divisors. Where the number is 1, the page prints 1 with no factors at all and one divisor, because 1 is neither prime nor composite and has to be handled as its own case rather than forced into either.

Four numbers, their factorizations, and the two counts side by side

NumberPrime factorizationPrime factorsDivisors
122^2 * 336
602^2 * 3 * 5412
3602^3 * 3^2 * 5624
7207202^4 * 3^2 * 5 * 7 * 11 * 1310240

The two count columns are the reason this table exists, and they pull apart as you read down. Twelve gives 3 and 6; sixty gives 4 and 12; three hundred and sixty gives 6 and 24; and 720720 gives 10 and 240. Both columns are correct in every row, and the growing gap between them is the point. The left count adds the exponents, so it only grows when a new prime appears or an existing one repeats. The right count multiplies one more than each exponent, so every repeat of a prime multiplies it — which is why a number built from many small primes with high exponents collects divisors far faster than its size suggests. The last row makes that vivid: 720720 is well under a million, and it has two hundred and forty divisors, more than any other number below a million. It is also the reason the input ceiling is what it is rather than something smaller, since a page about factorization ought to cover the most factorable number in its own range.

Formula

360 = 2^3 * 3^2 * 5; Omega(360) = 3 + 2 + 1 = 6; d(360) = (3+1) * (2+1) * (1+1) = 24

n
The number being broken up — a whole number from 1 to 1000000. The range is the one the number theory module uses throughout, so it matches the factor page exactly and a reader moving between them finds the same edges. Decimals are refused rather than rounded, and 0 and negatives are refused because prime factorization is a statement about positive whole numbers
p
A prime factor — a prime that divides n exactly. The page finds them by trial division in ascending order, so the smallest prime is always pulled out first and the printed factorization always runs from smallest prime to largest. For 360 the primes are 2, 3 and 5, and no other prime divides it
e
The exponent on a prime — how many times that prime appears in the product. 360 is 2 × 2 × 2 × 3 × 3 × 5, so 2 appears three times and 3 appears twice. A prime that appears once is printed with no exponent at all: the 5 in 360 is written as plain 5 rather than 5^1, which is the usual convention and keeps short factorizations readable
2^3 * 3^2 * 5
The factorization of 360 as printed, and the default input. The caret stands for the exponent and the asterisk for multiplication, so the whole thing survives being copied into a plain text field or a search box. There is exactly one such expression for every whole number above 1, which is what makes it worth printing: 360 cannot also be written as some other product of primes
Omega(360) = 3 + 2 + 1 = 6
The number of prime factors counting repeats: three 2s, two 3s and one 5 make six. This is the count that surprises people, because 360 feels like it is built from three primes rather than six. The recipe is to add the exponents rather than count the distinct primes, and the two answers differ whenever any exponent is above 1
d(360) = (3+1) * (2+1) * (1+1) = 24
The number of positive divisors, worked out from the same exponents by adding one to each and multiplying. The list is 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180 and 360 — twenty-four of them. This is a different question from the one above: it counts the numbers that divide 360, not the primes that build it

The factorization is what you want when a question is about the multiplicative structure of a number rather than its size. Simplifying a fraction or a square root is the everyday case: the square root of 72 simplifies to 6√2 because 72 = 2³ × 3², and the exponent of each prime tells you how much of it can come out from under the radical — that is the same factorization the radical page reads. Finding a greatest common factor or a least common multiple of two numbers is also this, done once per number: the shared primes to their smaller exponents give the first, and all primes to their larger exponents give the second. Divisibility questions are answered the same way, since a number divides another exactly when its primes and exponents are all available in the other. In number theory the factorization settles whether a number is prime, how many divisors it has, whether it is a perfect square (every exponent even), and whether it is a perfect cube. The limits of the method are worth knowing too: trial division is fast on a million but hopeless on a hundred-digit number, and that gap between easy and hard is exactly what public-key cryptography is built on. When the question is which numbers divide yours rather than which primes build it, the factor page lists them; when it is whether the number is prime at all, the prime page answers that directly.

Worked examples

  1. The default case: 360

    1. 360 is even, so divide by 2: 360 / 2 = 180, then 180 / 2 = 90, then 90 / 2 = 45 — three times in all
    2. 45 is not even; the next prime is 3, and 45 / 3 = 15, then 15 / 3 = 5 — twice
    3. 5 is prime, so the factorization is 2 × 2 × 2 × 3 × 3 × 5, written 2^3 * 3^2 * 5
    4. Count the prime factors with repeats: 3 + 2 + 1 = 6
    5. Count the divisors from the exponents: (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24

    The default input, and the one that shows why the two counts are printed at all. Six and twenty-four sit next to each other and a reader who expects them to match will think one is broken. They are not: six is how many prime pieces the number is made of when you keep every repeat, and twenty-four is how many numbers divide it. The gap between them comes from the exponents — every repeat of a prime multiplies the divisor count without adding much to the piece count. Check either by hand and the arithmetic is short; check both and you will remember which is which.

  2. The small case that shows the gap: 12

    1. 12 / 2 = 6, and 6 / 2 = 3, so 2 appears twice
    2. 3 is prime, so the factorization is 2^2 * 3
    3. Count the prime factors with repeats: 2 + 1 = 3, which is 2, 2 and 3
    4. List the divisors: 1, 2, 3, 4, 6, 12 — six of them
    5. Check with the recipe: (2 + 1) × (1 + 1) = 3 × 2 = 6, which matches the list

    The clearest small example of the confusion this page is built around, because both counts are small enough to verify by hand in seconds. Twelve is made of three primes — 2, 2 and 3 — and six numbers divide it. Reading the output as '3 divisors' or '6 prime factors' both sound plausible and both are wrong. The divisor list also shows the pairing that makes six an even count: 1 with 12, 2 with 6, 3 with 4. Twelve is not a perfect square, so no divisor pairs with itself, and that is why the count is even.

  3. The awkward case: 1

    1. 1 is not divisible by any prime — dividing by 2, 3, 5 or any other leaves a fraction
    2. So there are no prime factors, and the count of them is 0
    3. The only positive number that divides 1 is 1 itself, so the divisor count is 1
    4. The factorization prints as the single digit 1 rather than as an empty field

    The case that has to be decided rather than derived, and the decision is to print 1. Leaving the factorisation blank would read as a failure to compute, which is the one thing a result panel must never look like. The two counts then fall out honestly: no primes at all, and one divisor. One is neither prime nor composite — it is the multiplicative identity, the number that changes nothing when you multiply by it — and the page does not pretend otherwise. It is accepted rather than refused because the input range starts at 1, and a range that excludes its own bottom value would be a stranger thing to explain.

Limitations

The input must be a whole number from 1 to 1000000. Zero is refused: every prime divides zero, so the product would have to be infinite. Negative numbers are refused for a related reason — the primes still divide them, but the sign has to be carried separately and the unique-factorization statement is about positive numbers. Decimals are refused rather than rounded, since rounding would silently answer a question about a different number. The ceiling of one million comes from the shared number theory module and is a matter of cost rather than of correctness: trial division by every prime up to the square root is fast at a million and hopeless at a number with twenty digits. This is a genuine boundary of the method, and it is the same boundary that makes public-key cryptography work. The page reports the factorization and two counts, and nothing else: it does not list the divisors themselves, does not compute a greatest common factor or a least common multiple across several numbers, and does not simplify radicals or fractions. An exponent of 1 is never printed, so a prime that appears once shows as a bare number, and the multiplication sign is an asterisk throughout, which means the output is plain ASCII with no thousands separators. Finally, the reference table below shows four fixed numbers rather than following your input.

Frequently asked questions

What is the difference between the two counts on this page?
The first counts prime factors with repeats kept, the second counts divisors. For 12 the answers are 3 and 6, and both are right. Twelve is 2 × 2 × 3, so it is made of three prime pieces; and 1, 2, 3, 4, 6 and 12 all divide it, so it has six divisors. The confusion is natural because the two numbers are close together on small inputs. The recipe for the first is to add the exponents; the recipe for the second is to add one to each exponent and multiply. That multiplication is why the second count runs away so much faster — every extra repeat of a prime multiplies the divisor count while adding only one to the first.
Is there only one prime factorization for a number?
Yes, and that is a theorem rather than a convention. Every whole number above 1 can be written as a product of primes, and there is exactly one way to do it once you ignore the order. Three hundred and sixty is only ever 2³ × 3² × 5; it is not also some other product of primes. The result is called the fundamental theorem of arithmetic, and without it printing a factorization would be a curiosity rather than an answer. It is also why the page can print the smallest prime first and be sure that is the canonical form — the order is chosen for readability, and nothing is lost by fixing it.
What does the page do with 1?
It prints 1 as the factorization, with zero prime factors and one divisor. One is neither prime nor composite: it has no prime factorization in the usual sense, and the theorem above is stated for numbers above 1 for that reason. But an empty result panel would read as a failure to compute, so the page prints the digit and reports the two counts honestly. The divisor count of 1 is genuinely 1, since the only positive number dividing 1 is 1 itself, and the prime factor count is genuinely 0. One is accepted rather than refused because the input range starts at 1, and refusing the bottom of your own range takes more explaining than answering it.
Why does it stop at a million?
Because trial division is the method, and its cost grows with the square root of the number. Finding the primes of a number near a million means testing divisors up to a thousand, which is instant. Finding the primes of a number with twenty digits means testing up to ten billion, which is not. That gap is not an implementation detail — it is a real property of the problem, and it is the assumption public-key cryptography is built on, where the difficulty of factoring large numbers is what keeps a message private. Within a million every answer comes back immediately, and the ceiling is stated in the input rather than hidden in a timeout.
When would I want a factorization rather than a list of factors?
When the question is about structure rather than membership. Simplifying the square root of 72 needs 72 = 2³ × 3², because the exponents tell you how much of each prime can come out from under the radical, giving 6√2. Finding a greatest common factor across two numbers needs both factorizations, since the answer is the shared primes at their smaller exponents. Checking whether a number is a perfect square is a glance at the exponents — all even means yes. Listing divisors is a different question, and depending on the number it can be a much longer answer: 720720 has 240 of them, which is a lot to print and not much to look at. The factor page on this site lists them when that is what you need.
Why is no exponent printed when a prime appears once?
Because writing 5^1 for a single 5 is noise. The convention in mathematics is to print an exponent only when it is greater than one, so 360 is 2^3 * 3^2 * 5 with the last term bare. Nothing is lost by dropping it: the absence of an exponent means the exponent is one, unambiguously, and a factorization made entirely of single primes — which is what a square-free number has — reads as a plain product with no carets at all. The same convention is why 97, which is prime, prints as just 97 rather than as 97^1.

References

Related calculators