What prime factorization is
Prime factorization means rewriting a whole number as a product of prime numbers — the numbers greater than 1 whose only divisors are 1 and themselves (2, 3, 5, 7, 11, 13…). The fundamental theorem of arithmetic promises that every integer above 1 has exactly one prime factorization, apart from the order of the factors. That is why 360 always breaks down into 2 x 2 x 2 x 3 x 3 x 5, no matter how you get there.
When the same prime shows up more than once, we collect it with an exponent: 2 x 2 x 2 becomes 2^3. So the compact form of 360 is 2^3 x 3^2 x 5. This calculator gives you both views — the compact form with exponents and the full list of factors — and it tells you whether the number is prime (it cannot be broken down any further) or composite.
Every calculation runs in your browser; nothing is sent to a server.
How to use the calculator
- Type an integer from 2 up to 1,000,000,000,000 (10^12) in the field.
- Read the factorization with exponents in the dark card, and just below it whether the number is prime or composite.
- Check the list of prime factors (with repetition), the total number of factors and how many distinct primes there are.
- Press Copy to send the whole expression (for example
360 = 2^3 x 3^2 x 5) to your clipboard.
The result updates as you type — there is no “calculate” button to press.
The method: trial division
The algorithm tries to divide the number by increasing primes:
- Divide by 2 as many times as possible; each successful division adds 1 to the exponent of 2.
- Move on to the odd numbers 3, 5, 7, 9… and repeat for each.
- You only need to test divisors up to the square root of the number: once
d x dis larger than what remains, that remainder is already prime. - If a value greater than 1 is left at the end, that leftover is the final prime factor.
Testing only up to the square root is what keeps it fast: for a number close to 10^12 you check divisors up to a million, not up to a trillion.
| Number | Prime factors | Total (with repetition) | Distinct | Prime? |
|---|---|---|---|---|
| 12 | 2^2 x 3 | 3 | 2 | No |
| 84 | 2^2 x 3 x 7 | 4 | 3 | No |
| 100 | 2^2 x 5^2 | 4 | 2 | No |
| 360 | 2^3 x 3^2 x 5 | 6 | 3 | No |
| 1000 | 2^3 x 5^3 | 6 | 2 | No |
| 1024 | 2^10 | 10 | 1 | No |
| 13195 | 5 x 7 x 13 x 29 | 4 | 4 | No |
| 97 | 97 | 1 | 1 | Yes |
Worked example
Let us factorize 360 by hand, following the method:
- 360 ÷ 2 = 180
- 180 ÷ 2 = 90
- 90 ÷ 2 = 45 → 2 appears three times, so 2^3
- 45 ÷ 3 = 15
- 15 ÷ 3 = 5 → 3 appears twice, so 3^2
- 5 ÷ 5 = 1 → 5 appears once
Putting it together: 360 = 2^3 x 3^2 x 5. The list with repetition is 2 x 2 x 2 x 3 x 3 x 5 — six factors in total and three distinct primes (2, 3 and 5). Check: 8 x 9 x 5 = 360. Because it has more than one prime factor, 360 is composite, not prime.
Why it matters
Prime factorization is the backbone of a lot of middle-school arithmetic. From it you can read off the greatest common divisor (multiply the shared primes at their lowest exponent) and the least common multiple (take every prime at its highest exponent), simplify fractions, count divisors or spot perfect squares. It also underpins modern cryptography: multiplying two large primes is easy, but undoing that product — factoring it — is so slow that it keeps your messages safe.
Frequently asked questions
Is 1 a prime number?
No. By convention 1 is neither prime nor composite: it does not have exactly two distinct divisors. That is why the calculator only accepts numbers from 2 upward — 2 is the first prime and the only even one.
How do I tell whether a number is prime?
If its factorization is a single factor with exponent 1 (the number itself), then it is prime: it cannot be written as a product of smaller primes. The calculator states this for you with the message “is a prime number”.
Why only test divisors up to the square root?
Because divisors come in pairs: if a x b = n and a is at most the square root of n, then b is at least that square root. Searching for the smaller partner of each pair means you never have to look past the square root; if you found none by then, whatever remains is prime.
What is the largest number allowed?
The limit is 1,000,000,000,000 (10^12). With trial division, factoring larger numbers can take too long in a browser, so we cap it there to keep every answer instant.
Does it work for negative numbers or decimals?
No: prime factors are only defined for positive integers greater than 1. If you enter a decimal, a negative, 0 or 1, the tool shows a short message instead of returning a wrong answer.