Prime Factorization Calculator · Tutorial

How to check whether a large number is prime

4 min readbeginnerUpdated

Is 1,000,000,007 prime? Checking by hand would mean trying thousands of divisors. You will test it in a moment and learn how to read the result.

What you need

Steps

  1. Enter the number

    Type 1000000007. Spaces or commas between digit groups are fine, so 1,000,000,007 works too.

  2. Read the result

    The factorisation is just the number itself and the note says it's prime: its only divisors are 1 and 1,000,000,007.

  3. Compare with a composite number

    Try 1000000005. It ends in 5, so 5 is a factor, and the calculator shows its full factorisation and divisor count.

  4. Know why it's fast

    To be sure by trial division you would test every prime up to the square root, about 31,600. The calculator uses the Miller–Rabin test instead, which proves primality for numbers of this size in a few steps.

Try it yourself

Opens the Prime Factorization Calculator with this tutorial's sample loaded.

Try it now

Common mistakes

Including decimals or signs
Primality applies to whole numbers above 1. Remove decimal points and minus signs.
Assuming odd numbers are prime
Many odd numbers are composite, such as 91 = 7 × 13. Always check.

Next steps

Go back to the Prime Factorization Calculator, or keep going with one of these: