Prime Factorization Calculator
Break any whole number up to a trillion into the primes that multiply to make it — in exponent form or written out in full — and get every divisor, how many there are, and what they sum to, straight from the exponents.
Break a number into primes
Any whole number from 1 up to a trillion. Trial division runs in about √n steps, so the ceiling keeps the answer instant.
Exponent form is the compact one. The expanded product is what a factor tree ends up with.
360 is not prime. Those exponents give it 24 divisors, which add up to 1,170.
- Exponent form
- 2³ × 3² × 5
- Expanded product
- 2 × 2 × 2 × 3 × 3 × 5
- Distinct primes
- 3
- Is it prime?
- No
- Number of divisors
- 24
- Sum of divisors
- 1,170
- Divisors
- 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, 360
| Prime | Exponent | Power | Divisor choices |
|---|---|---|---|
| 2 | 3 | 8 | 4 |
| 3 | 2 | 9 | 3 |
| 5 | 1 | 5 | 2 |
One factorization, and everything that falls out of it
The fundamental theorem of arithmetic is the reason this page can be short. Every integer above 1 factors into primes in exactly one way, apart from the order you write them in. Not “at least one way” — exactly one. That uniqueness is what makes primes the building blocks rather than merely a set of useful numbers, and it is why the factorization is not one fact about 360 among many but the fact from which the others follow.
n = p₁^e₁ × p₂^e₂ × … • d(n) = Π(eᵢ + 1) • σ(n) = Π(1 + pᵢ + pᵢ² + … + pᵢ^eᵢ)- pᵢ, eᵢ
- Each distinct prime and how many times it divides n
- d(n)
- How many divisors n has, counting 1 and n itself
- σ(n)
- The sum of all of those divisors
Why trial division stops at the square root
If n = a × b, then a and b cannot both exceed √n — their product would be larger than n. So one of every divisor pair is at or below the square root, and once the search passes √n of whatever is left, the remainder is either 1 or a prime in its own right. No further division is needed. This calculator divides out every factor of 2 first, on its own, so the main loop can start at 3 and step by 2, skipping every even candidate for the cost of one extra branch.
Why the divisor count is a product of exponents
Building a divisor of 360 = 2³ × 3² × 5 means choosing a power of each prime independently: one of 2⁰, 2¹, 2², 2³; one of 3⁰, 3¹, 3²; one of 5⁰, 5¹. That is 4 × 3 × 2 = 24 combinations, every one of them a different divisor, and every divisor of 360 arising from exactly one combination. Counting the choices counts the divisors, which is why d(360) = 24 needs no list. The divisor sum works the same way, one geometric series per prime: (1+2+4+8)(1+3+9)(1+5) = 15 × 13 × 6 = 1,170.
Factoring 360 by hand
Start with the smallest prime and keep going until it stops dividing. 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45. Forty-five is odd, so 2 is exhausted after three divisions — that is the 2³.
Move to 3. 45 ÷ 3 = 15 and 15 ÷ 3 = 5. Five is not divisible by 3, so that is the 3². Now try 5: 5 ÷ 5 = 1, and the remainder is gone. The factorization is 2³ × 3² × 5, which multiplies back as 8 × 9 × 5 = 360.
Notice where the search could have stopped. Once 45 was reduced to 5, the next candidate to test would have been 5 itself, and 5² = 25 is already larger than 5 — so whatever remained had to be prime. That single observation is what turns a search of 360 steps into a search of a handful.
From the exponents 3, 2 and 1: the divisor count is (3+1) × (2+1) × (1+1) = 24, and the divisor sum is 15 × 13 × 6 = 1,170. Neither figure required listing anything. The list is shown above anyway, because seeing 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 … 360 is how the counting rule stops feeling like a trick.
Trial division is O(√n), and that is the good news
A trillion has a square root of a million, so the loop above runs at most 500,000 times — a few milliseconds, even in a browser. Ten thousand times larger would mean fifty million steps and a page that stops responding. That is why the input is capped at 10¹².
What is worth noticing is that nobody has a better general answer. There are faster algorithms — Pollard rho, the quadratic sieve, the general number field sieve — but none of them is fast, and the gap between multiplying two large primes and recovering them from the product has never been closed. RSA encryption is built on precisely that gap. An RSA-2048 public key is a number about 617 decimal digits long with exactly two prime factors; producing it took microseconds, and finding those factors is beyond every computer that exists. NIST currently expects 2048-bit RSA to remain adequate through 2030 on that basis, while recommending migration to post-quantum algorithms for anything that must stay secret longer.
What this calculator assumes
- The input is a whole number from 1 through 1,000,000,000,000. Decimals have no prime factorization — the primes are defined over the integers.
- Negative numbers are not accepted. −12 does factor, as −1 × 2² × 3, but −1 is a unit rather than a prime, and carrying it through would put a sign in the divisor list where it does not belong.
- Zero is rejected outright. Every integer divides 0, so it has no factorization and no finite list of divisors to report.
- 1 is neither prime nor composite. It has no prime factors, one divisor, and a divisor sum of 1 — all of which the tool reports rather than treating 1 as an error.
- Every figure is an exact integer. Nothing is rounded, and nothing needs to be: the largest divisor sum reachable below 10¹² is under 5 × 10¹², comfortably inside the range where JavaScript numbers are exact.
- The divisor list is trimmed to the first 60 entries on screen when a number has more than that. The count and the sum always cover all of them.
Prime factorization FAQ
What is the prime factorization of 360?
2³ × 3² × 5, or written out in full, 2 × 2 × 2 × 3 × 3 × 5. Divide by 2 three times to reach 45, then by 3 twice to reach 5, and 5 is prime, so the factorization is complete. Those exponents alone tell you 360 has 24 divisors and that they add up to 1,170.
Why is 1 not a prime number?
Because uniqueness would break if it were. The fundamental theorem of arithmetic says every integer above 1 has exactly one prime factorization — but if 1 counted as prime, 6 could be written as 2 × 3, or 1 × 2 × 3, or 1 × 1 × 2 × 3, endlessly. Excluding 1 is not an arbitrary convention; it is what makes the word 'exactly' in that theorem true. The same reasoning gives 1 no prime factors at all, and exactly one divisor.
How do you find the number of divisors without listing them?
Add one to each exponent and multiply. For 360 = 2³ × 3² × 5 that is (3+1) × (2+1) × (1+1) = 24. The reason is that building a divisor means choosing a power of each prime: any of 2⁰, 2¹, 2², 2³, times any of 3⁰, 3¹, 3², times either 5⁰ or 5¹. Every choice gives a different divisor and every divisor comes from exactly one choice, so counting the choices counts the divisors.
Why does the calculator stop at a trillion?
Trial division tests candidates up to the square root of the number, so a trillion means at most about 500,000 steps — a few milliseconds. Ten thousand times larger would mean fifty million steps and a page that visibly freezes. There is no known fast general method to close that gap, which is exactly the point: the difficulty of factoring large numbers is what RSA encryption is built on.
What does prime factorization have to do with encryption?
RSA takes two very large primes, multiplies them, and publishes the product. Multiplying takes microseconds. Recovering the two primes from the product is the same problem this calculator solves by brute force, and at RSA-2048 sizes — a number roughly 617 decimal digits long — no one on Earth can do it. The whole security argument is the gap between how cheap multiplication is and how expensive its inverse is. NIST expects 2048-bit RSA keys to hold until at least 2030 on that basis.
How do I use prime factors to find a GCF or LCM?
Factor both numbers, then compare exponents prime by prime. The greatest common factor takes the smaller exponent of each shared prime; the least common multiple takes the larger exponent of every prime that appears in either. For 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7, the GCF is 2² × 3 = 12 and the LCM is 2³ × 3² × 5 × 7 = 2,520.
Sources and review notes
- NIST Digital Library of Mathematical Functions §27.2 — functions of number theory, including the fundamental theorem of arithmetic and the divisor functions d(n) and σ(n)
- NIST SP 800-57 Part 1 Rev. 5 — Recommendation for Key Management, the source for the RSA key-strength timeline cited above
- OEIS A000005 — the divisor-counting function, useful for checking a divisor count against an independent table
The arithmetic on this page is definitional and has no data behind it to go stale. What can go wrong is the implementation, so the engine is a pure function under unit test, including the two cases that trip most factorizers: 1, which has no prime factors, and a number at the very top of the accepted range.