Prime Factorization Calculator
Type a whole number to break it into primes, with a factor tree, the division ladder, every factor and factor pair, and a prime check. Switch to Advanced for several numbers, primes in a range and root simplifying.
Any whole number up to 300 digits. Sums work too: 2^10, 3 × 7 × 11, 20!, 1e12. Fractions and decimals (3/4, 0.75) show minus powers.
Two to 30 whole numbers, separated by commas. Each one is broken into primes, then the primes give the HCF and LCM. For the ladder, Euclid and word problems, use the LCM & HCF calculator.
Counts every prime up to 100 million (ranges up to 10 million wide). Above that, keep the range under 100,000 wide.
Show the working
More about this number
How your prime factors are worked out
Your number, step by step: divide by the smallest prime, keep going until you reach 1, then group the primes as powers.
- 1
Divide by a prime
360 ÷ 2= 180smallest: 2
- 2
Keep dividing
until you reach 12 × 2 × 2 × 3 × 3 × 56 primes found
- 3
Group the primes
same primes aspowers2³ × 3² × 5
- 4
Count the factors
(3+1)×(2+1)×(1+1)= 4 × 3 × 224 factors
Read more: the formula, a worked example, divisibility rules and how huge numbers are handled
A prime number is a whole number above 1 that only 1 and itself go into: 2, 3, 5, 7, 11, 13 and so on. Every other whole number above 1 is composite, and can be broken into primes multiplied together in exactly one way. That is its prime factorization (prime factorisation in UK spelling). Prime factors are the building blocks for factors, HCF and LCM, simplifying fractions and roots, and much more.
The formula
n = p₁^a × p₂^b × p₃^c × … (each p a prime, smallest first)
number of factors = (a + 1) × (b + 1) × (c + 1) × …
sum of factors = (p₁^(a+1) − 1) ÷ (p₁ − 1) × (p₂^(b+1) − 1) ÷ (p₂ − 1) × …
Euler’s totient φ(n) = n × (1 − 1/p₁) × (1 − 1/p₂) × …
k-th root: take each prime’s power ÷ k; the whole part comes out, the remainder stays inside
you only need to try primes up to √n: if none go in, n is prime
Worked example
360. Divide by the smallest prime that goes in each time:
- 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45. 2 does not go into 45.
- 45 ÷ 3 = 15, 15 ÷ 3 = 5. 3 does not go into 5.
- 5 ÷ 5 = 1. Stop.
- So 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5. Check: 8 × 9 × 5 = 72 × 5 = 360.
- Number of factors: (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24.
- Sum of factors: (16 − 1) ÷ 1 × (27 − 1) ÷ 2 × (25 − 1) ÷ 4 = 15 × 13 × 6 = 1,170. Take off 360 itself and the proper factors add up to 810, which is more than 360, so 360 is an abundant number.
- Square root: one pair of 2s and one pair of 3s come out, leaving 2 × 5 inside: √360 = 2 × 3 × √10 = 6√10.
- Euler’s totient: 360 × ½ × ⅔ × ⅘ = 96 numbers from 1 to 360 share no factor with 360.
Factor tree, ladder and listing
- Factor tree. Split the number into any two factors, then split each branch again until every branch ends in a prime. You can start 360 = 18 × 20 or 360 = 2 × 180: the primes at the ends are always the same.
- Ladder (repeated division). Write the number, divide by the smallest prime that goes in, write the answer underneath and repeat until you reach 1. The primes down the side are the answer.
- All factors. Every factor is made by choosing a power of each prime: for 360, 2⁰ to 2³, 3⁰ to 3² and 5⁰ or 5¹. Factors come in pairs that multiply to the number (1 × 360, 2 × 180 … 18 × 20). A number has an odd count of factors only when it is a perfect square.
Quick divisibility checks
| Prime | It goes in when… | Example |
|---|---|---|
| 2 | the last digit is even (0, 2, 4, 6, 8) | 360 ends in 0 |
| 3 | the digits add up to a multiple of 3 | 3 + 6 + 0 = 9 |
| 5 | the last digit is 0 or 5 | 45 ends in 5 |
| 7 | double the last digit, take it from the rest, and the answer is a multiple of 7 | 1001: 100 − 2 = 98 = 14 × 7 |
| 11 | the alternating sum of the digits is a multiple of 11 | 1001: 1 − 0 + 0 − 1 = 0 |
| 13 | add 4 × the last digit to the rest, and the answer is a multiple of 13 | 1001: 100 + 4 = 104 = 8 × 13 |
The primes up to 100
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
There are 25 of them. There are 168 primes below 1,000 and 78,498 below 1,000,000, and they never run out: Euclid proved more than 2,000 years ago that there are infinitely many.
How huge numbers are handled
All maths is exact, with whole numbers of any size up to 300 digits. The calculator first divides by every prime below 10,000. What is left is checked with the Miller–Rabin test, which is exact below about 3.3 × 10²⁴ and, above that, has never been known to call a composite number prime with these bases. Pieces that are not prime are split with Pollard’s rho method, which finds factors up to about 12 digits in a moment. It runs for up to 2 seconds while you type (10 seconds if you ask), then stops and shows the part it could not split. That part is definitely not prime; its factors are just too big to find quickly in a web browser.
Famous examples to try: 2^67 − 1 (Frank Cole split it in 1903 after “three years of Sundays”: 193,707,721 × 761,838,257,287), 2^64 + 1 (274,177 × 67,280,421,310,721) and 600851475143 (71 × 839 × 1,471 × 6,857).
Common questions
What is prime factorization?
Prime factorization (or factorisation) means writing a whole number as primes multiplied together. 360 = 2 × 2 × 2 × 3 × 3 × 5, which is written with powers as 2³ × 3² × 5. Every whole number above 1 has exactly one prime factorization, apart from the order of the primes. Mathematicians call this the fundamental theorem of arithmetic.
How do you find the prime factors of a number?
Divide by the smallest prime that goes in exactly, write it down, and repeat with the answer until you reach 1. For 360: 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45, ÷ 3 = 15, ÷ 3 = 5, ÷ 5 = 1. The primes you divided by, 2, 2, 2, 3, 3 and 5, are the prime factors. A factor tree does the same thing by splitting into any two factors.
How many factors does a number have?
Write the prime factorization, add 1 to each power and multiply. 360 = 2³ × 3² × 5¹, so it has (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24 factors. Each factor picks a power of 2 from 0 to 3, a power of 3 from 0 to 2 and a power of 5 from 0 to 1, and that gives 24 choices.
Is 1 a prime number?
No. A prime has exactly two different factors: 1 and itself. 1 has only one factor, so it is not prime, and it is not composite either. Leaving 1 out keeps the prime factorization of every number unique: if 1 were prime, you could write 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3, and so on forever.
How do you simplify a square root with prime factors?
Factorise the number and pull out each pair of the same prime. 72 = 2 × 2 × 2 × 3 × 3. The pair of 2s comes out as 2 and the pair of 3s as 3, leaving one 2 inside: √72 = 2 × 3 × √2 = 6√2. For a cube root, pull out groups of three instead: 360 = 2³ × 3² × 5, so ∛360 = 2∛45.
Why can’t big numbers always be factorised?
Checking if a number is prime is quick even for hundreds of digits, but finding the factors of a big number made of two large primes is very slow. That is what keeps online banking safe. This calculator splits numbers with factors up to about 12 digits in a moment. When the smallest factor is bigger, it tells you the part it could not split and lets you try for longer.
Related calculators
Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.