Prime Factorization Calculator
Prime factorisation writes a number as a product of primes. The calculator divides by 2 as often as it can, then by 3, 5, 7 and each odd number after, up to the square root of what is left. Anything left above 1 is the last prime factor. For example, 360 = 2^3 × 3^2 × 5.
Last updated by Ultra Calculator
Prime Factorization
How to calculate it
n = p₁^k₁ × p₂^k₂ × ... × pᵣ^kᵣ
- n
- the number being factorised
- p₁, p₂, ..., pᵣ
- the different prime factors, from smallest to largest
- k₁, k₂, ..., kᵣ
- how many times each prime divides n
- r
- how many different primes there are
The calculator finds the primes by trial division: it divides by 2 until the result is odd, then tries 3, 5, 7 and so on while the divisor is no bigger than the square root of what remains.
Worked example
Prime factors of 12
12 = 2 × 2 × 3, which the calculator writes in index form as 2^2 × 3. The different prime factors are 2 and 3.
| Number | 12 |
|---|
| Prime factorisation | 2^2 × 3 |
|---|---|
| All prime factors | 2 × 2 × 3 |
| Is it prime? | 0 |
| Different prime factors | Invalid |
| Number | 12 |
How to use this calculator
- Enter a whole number from 2 to 1,000,000 in the Number box.
- Read the Prime factorisation in index form, where 2^3 means 2³ (2 × 2 × 2).
- Check All prime factors for the same answer written out in full, smallest first.
- Is it prime? shows true when the number is prime, and Different prime factors lists each prime once.
Frequently asked questions
How do you find the prime factorisation 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 60: 60 ÷ 2 = 30, 30 ÷ 2 = 15, 15 ÷ 3 = 5, 5 ÷ 5 = 1, so 60 = 2^2 × 3 × 5.
What is a factor tree?
A diagram that splits a number into any two factors, then splits each factor again until every branch ends in a prime. 60 might split into 6 × 10, then 2 × 3 and 2 × 5. Whichever way you split it, the primes at the ends are the same.
Is 1 a prime number?
No. A prime has exactly two factors, 1 and itself, and 1 has only one. If 1 counted as prime, factorisations would stop being unique, which is why the calculator starts at 2.
How do you use prime factors to find the HCF and LCM?
Write both numbers in index form. The HCF uses each shared prime at its lowest power, and the LCM uses every prime at its highest power. For 12 = 2^2 × 3 and 18 = 2 × 3^2, the HCF is 2 × 3 = 6 and the LCM is 2^2 × 3^2 = 36.
What is the largest number it can factorise?
1,000,000, which is 2^6 × 5^6. The largest prime it accepts is 999,983.
Learn more
Each number has one prime factorisation
The fundamental theorem of arithmetic says every whole number above 1 is either prime or a product of primes, and that product is the same however you find it, apart from the order. That is why a factor tree and repeated division always agree.
Why the search stops at the square root
A composite number always has a factor no bigger than its square root, because two factors that were both bigger would multiply to more than the number. So once the trial divisor passes the square root of what is left, whatever remains is prime.
Prime and composite numbers
A prime has exactly two factors, 1 and itself: 2, 3, 5, 7, 11 and so on. A composite number, such as 12, has more. The number 1 is neither.
- Finding the HCF and LCM of two numbers by hand, as taught for GCSE maths
- Simplifying a fraction such as 84/126 by cancelling shared primes (2 × 3 × 7 = 42), which leaves 2/3
- Simplifying a square root: 72 = 2^3 × 3^2, so √72 = 6√2
- Checking whether a number up to 1,000,000 is prime
- Counting factors: 360 = 2^3 × 3^2 × 5 has (3 + 1)(2 + 1)(1 + 1) = 24 factors
Stopping at a factor that isn't prime
60 = 4 × 15 is a factorisation, but not a prime one. Keep splitting until every factor is prime: 2 × 2 × 3 × 5.
Counting 1 as a prime factor
1 is not prime, so it never appears in a prime factorisation. 7 = 7, not 1 × 7.
Losing repeated factors
12 is 2 × 2 × 3, not 2 × 3. Writing it in index form, 2^2 × 3, keeps the count visible.
Writing the power next to the wrong number
2^3 × 5 means 2 × 2 × 2 × 5 = 40, while (2 × 5)^3 is 1,000. Each power belongs only to the prime directly before it, unless brackets say otherwise.
Methodology and sources
The calculator accepts whole numbers from 2 to 1,000,000 and asks for a whole number if you enter a decimal such as 12.5. It uses trial division: it removes every factor of 2, then tries 3, 5, 7 and each later odd number while the divisor is no larger than the square root of what is left. Any remainder above 1 is prime and becomes the last factor. For this range that means at most about 500 trial divisors, and the answer is exact. Is it prime? shows true when the only factor is the number itself. Different prime factors are listed separated by commas.