How this calculator works
- Step 1Try 2, then 3÷ 2, ÷ 3Divide out each as many times as it goes.
- Step 2Then 5, 7, 11…6k ± 1Only numbers next to multiples of 6 can be prime.
- Step 3Stop at the root√nWhatever is left above 1 is itself prime.
Every whole number above 1 can be written as a product of primes in exactly one way. The calculator divides out the smallest primes first, like the ladder method taught in school.
Worked example: 120
- Ladder
divide by the smallest prime that goes
- 120 ÷ 260
- 60 ÷ 230
- 30 ÷ 215
- 15 ÷ 35 (prime)
- So 120 =2³ × 3 × 5
This matches OpenStax’s Example 2.50. Their Examples 2.48 and 2.49 give 48 = 2⁴ × 3 and 84 = 2² × 3 × 7.
Prime or composite
- Prime97Its only factors are 1 and itself.
- Composite12016 divisors in all.
Read the result
The headline is the factorisation with powers; the line beneath writes every factor out.
The number of divisors is the product of each power plus one: for 120, (3 + 1)(1 + 1)(1 + 1) = 16.
Assumptions and limits
- Whole numbersFrom 2 to 10¹², so results are instant.
- Unique answerOrder does not matter; factors are listed smallest first.
Related number tools
Prime factors are the building blocks of a number. Factors, LCM and HCF follow from them.
To list every factor and factor pair, use the factor calculator. For the LCM and HCF of several numbers, try the LCM and HCF calculator, and to simplify a square root, the root calculator.
Common mistakes
Mistake: Stopping at a composite factor such as 4.
Instead: Keep dividing until every factor is prime: 4 = 2².
Mistake: Calling 1 a prime.
Instead: 1 has only one factor, so it is neither prime nor composite.
Checking the method
Every golden case is rechecked with a sieve of primes and a full list of divisors.
An independent script builds every prime below a million with the sieve of Eratosthenes, factorises each number with them, and counts divisors directly.
Read how we test our calculators, or browse more maths calculators.