Loading…

Education08.04

Prime Factorization Calculator

Break any number down into its prime factors, check whether it’s prime, and see all of its factors plus the nearest primes on either side.

Back to Education

A whole number from 2 to 1 trillion (10¹²).

This runs entirely in your browser. We don’t store any data.

Prime factors

Enter a number to break it into prime factors.

How to use it

  1. 01

    Enter a whole number greater than 1.

  2. 02

    You’ll see its prime factorization or, if the number is prime, a note saying so.

  3. 03

    Below that you’ll find how many factors it has, the full list, and the closest primes.

How it works

A prime number can only be divided evenly by 1 and itself (2, 3, 5, 7, 11…). Every other whole number above 1 can be written as a product of primes in exactly one way. That’s the fundamental theorem of arithmetic.

The tool divides the number by 2, then by 3, then by numbers of the form 6k ± 1, stopping at the square root, since that’s as high as the smallest factor can be. Whatever is left at the end, if it’s greater than 1, is also prime.

From the factorization you can count the factors: add one to each exponent and multiply. 360 = 2³ × 3² × 5¹ has (3+1)(2+1)(1+1) = 24 factors.

Examples

  • A composite number

    360 = 2³ × 3² × 5, with 24 factors.

  • Is 97 prime?

    Yes. 97 isn’t divisible by 2, 3, 5 or 7, and √97 is less than 10, so there’s nothing else to check.

  • A large number

    1,000,000 = 2⁶ × 5⁶, with 49 factors.

Frequently asked questions

Is 1 a prime number?

No. By convention, primes start at 2. If 1 counted as prime, every number would have endless factorizations (6 = 2 × 3 = 1 × 2 × 3…), so they’d no longer be unique.

Why only test up to the square root?

If a number had two factors both bigger than its square root, their product would be bigger than the number itself. So there’s always at least one factor no larger than the square root.