Prime factorization calculator
Prime factors, primality test, all divisors and the division ladder.
- Instant
- Free
- Private (processed locally)
- No sign-up
Find the prime factorization of any number and check if it is prime
Every whole number from 2 upwards can be written as a product of primes in exactly one way, apart from the order of the factors: this is the fundamental theorem of arithmetic. 360 = 23 × 32 × 5, 1,001 = 7 × 11 × 13, and 97 cannot be split at all: it is prime. This calculator gives the factorization, tells you instantly whether the number is prime or composite, and shows the division ladder exactly as it is taught in class.
Prime factorization unlocks many everyday calculations: simplifying fractions, finding a GCD or LCM, counting divisors, simplifying square roots. It is used by middle and high school students, teachers preparing worksheets, math competition entrants and anyone curious about cryptography: the security of RSA relies on how hard it is to factor very large numbers.
-
Type the number
Enter a whole number in “Whole number to factor” (at least 2, up to 18 digits). Spaces and thousands separators are ignored, so 600,851,475,143 works as is. The “Try:” buttons load ready-made examples.
-
Read the verdict
The badge says “Prime number” or “Not prime: composite number”, then the factorization appears with exponents (360 = 2³ × 3² × 5) and its expanded form. The “Copy” button puts 2^3 × 3^2 × 5 on your clipboard.
-
Explore the properties
The “Arithmetic properties” cards give τ(n), σ(n), φ(n), the number of distinct prime factors ω(n) and of prime factors with multiplicity Ω(n), whether n is a perfect square, the sum of proper divisors, and the previous and next primes (up to 10¹²).
-
Check it by hand
The “Division ladder” table repeats every step (360 ÷ 2 = 180…) down to quotient 1, and “All divisors” lists every divisor in increasing order, with the prime divisors highlighted.
The method: fundamental theorem and formulas
For a whole number n ≥ 2, the factorization is written n = p1a1 × p2a2 × … × pkak. You get it by dividing by the smallest prime factor for as long as possible; you only need to test divisors up to √n, because a composite number always has a prime factor no larger than its square root.
For large inputs the tool chains three stages: trial division by the primes up to 10,000, a deterministic Miller-Rabin test to recognize primes, then Pollard’s rho algorithm (Brent’s variant) to split the remaining composite cofactors. Every calculation uses exact integers, with no rounding.
- p1 < p2 < … < pk: the distinct prime factors in increasing order; how many there are is written ω(n).
- ai: the exponent (multiplicity) of pi; the sum a1 + … + ak is Ω(n), the number of prime factors counted with repetition.
- τ(n) = (a1 + 1)(a2 + 1)…(ak + 1): the number of divisors, since a divisor picks an exponent from 0 to ai for each pi.
- σ(n) = ∏ (piai+1 − 1) / (pi − 1): the sum of all divisors; s(n) = σ(n) − n tells whether the number is perfect, abundant or deficient.
- φ(n) = n × ∏ (1 − 1/pi): Euler’s totient, the count of integers from 1 to n that are coprime to n.
- Perfect square: n is a square exactly when every ai is even; then √n = ∏ piai/2, for example √1,024 = 25 = 32.
Prime factorization examples
| Number | Prime factorization | τ(n) | σ(n) | φ(n) |
|---|---|---|---|---|
| 360 | 23 × 32 × 5 | 24 | 1,170 | 96 |
| 97 | prime | 2 | 98 | 96 |
| 1,001 | 7 × 11 × 13 | 8 | 1,344 | 720 |
| 1,024 | 210 (perfect square, 322) | 11 | 2,047 | 512 |
| 600,851,475,143 | 71 × 839 × 1,471 × 6,857 | 16 | 610,544,148,480 | 591,194,251,200 |
| 999,999,999,999,999,989 | prime | 2 | n + 1 | n − 1 |
Same values as displayed by the tool. For a prime n, σ(n) = n + 1 and φ(n) = n − 1; for 97, the neighboring primes are 89 and 101.
What is prime factorization used for?
- Simplifying fractions: 84/360 = (22 × 3 × 7)/(23 × 32 × 5) = 7/30 once the common factors 22 × 3 = 12 are cancelled.
- Finding a common denominator: the LCM of 360 and 84 is 2,520, the least common denominator for adding 1/360 and 1/84.
- Simplifying square roots: √360 = √(22 × 32 × 10) = 2 × 3 × √10 = 6√10: each pair of equal factors comes out of the root.
- Counting and listing divisors: handy for grouping problems (arranging 360 chairs in equal rows: 24 possible rows × columns layouts) and number theory homework.
- Cryptography and puzzles: RSA relies on factoring being hard; the famous Project Euler problem 3 asks for the largest prime factor of 600,851,475,143, which is 6,857.
Common mistakes
- Dividing by a non-prime: dividing 360 by 4 or 6 gives a correct quotient but an incomplete factorization; only divide by 2, 3, 5, 7, 11, 13…
- Treating 1 as prime: 1 has a single divisor and never appears in a factorization.
- Mixing up 23 and 2 × 3: 23 = 2 × 2 × 2 = 8, whereas 2 × 3 = 6; the exponent counts how many times the factor repeats.
- Assuming a number “looks prime”: 51 = 3 × 17, 91 = 7 × 13 and 1,001 = 7 × 11 × 13 are all composite; always test up to the square root.
All calculations run locally in your browser with exact integer arithmetic (BigInt): no number is sent or stored. Limits: 18 digits maximum; neighboring primes are shown up to 1012, the divisor list up to 1,000 divisors and the division ladder up to 40 prime factors counted with multiplicity.
Frequently asked questions
Why is 1 not a prime number?
A prime has exactly two distinct divisors, 1 and itself, while 1 has only one. More importantly, if 1 were prime, factorizations would no longer be unique: 360 = 2³ × 3² × 5 = 1 × 2³ × 3² × 5 = 1² × 2³ × 3² × 5, and so on. That is why 1 is neither prime nor composite, and the tool rejects it with an explanation.
How do I find the prime factorization by hand?
Divide by the smallest prime that divides the number evenly, then repeat with the quotient until you reach 1: 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45, 45 ÷ 3 = 15, 15 ÷ 3 = 5, 5 ÷ 5 = 1. Reading off the divisors gives 360 = 2³ × 3² × 5. You never need to test beyond the square root: √97 ≈ 9.8, so trying 2, 3, 5 and 7 proves that 97 is prime.
How do I count the divisors from the factorization?
Add 1 to each exponent and multiply: for 360 = 2³ × 3² × 5, τ(360) = (3+1)(2+1)(1+1) = 24 divisors. For 1,001 = 7 × 11 × 13 you get 2 × 2 × 2 = 8. The sum of divisors follows the same logic: σ(360) = 15 × 13 × 6 = 1,170.
How do I get the GCD and LCM from prime factors?
Factor each number: 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7. The GCD keeps the shared primes with the lowest exponent (2² × 3 = 12); the LCM keeps every prime with the highest exponent (2³ × 3² × 5 × 7 = 2,520). Check: 12 × 2,520 = 30,240 = 360 × 84.
How can I tell if a large number is prime?
Trial division up to the square root quickly becomes impractical: for an 18-digit number you would have to try every prime up to 10⁹. The tool therefore runs the Miller-Rabin test with the first 12 primes (2 to 37) as bases, which is proven never to fail below 3 × 10²³. Within the 18-digit limit (below 10¹⁸), “prime” is therefore a certainty, not a probability. Even the toughest case, a product of two 9-digit primes such as 999,999,929 × 999,999,937, is split in a fraction of a second.
What is Euler’s totient φ(n) used for?
φ(n) counts the integers from 1 to n that share no factor with n: φ(360) = 360 × (1 − 1/2)(1 − 1/3)(1 − 1/5) = 96. For a prime p, φ(p) = p − 1, so φ(97) = 96 as well. It also appears in RSA encryption: for n = p × q, φ(n) = (p − 1)(q − 1) is used to compute the private key.