At One Place

Prime number checker

Test whether a number is prime, and get its factors if it is not.

How it works

Tests a number for primality and, when it is composite, shows its prime factorisation.

Testing by trial division only needs divisors up to the square root. If a number has a factor larger than its square root, it must also have a matching one below it, so anything above that point has already been checked. That is why testing a number near a million takes a thousand steps rather than a million.

Two facts worth knowing. One is not prime, by definition rather than by accident — if it were, every number would have infinitely many factorisations and the fundamental theorem of arithmetic would fail. And two is the only even prime, which makes it the odd one out in a way that catches people.

Primes thin out but never run out. Euclid proved there are infinitely many around 300 BC, with an argument short enough to fit in a paragraph: multiply any finite list of primes together, add one, and the result is divisible by none of them.

This tool runs entirely in your browser. Nothing you enter is sent to a server, logged or stored, and the page keeps working with the network disconnected.

Common questions

Is 1 a prime number?
No, by definition. A prime has exactly two distinct divisors; one has only itself. Excluding it is what makes prime factorisation unique.
What is the largest known prime?
They are Mersenne primes of the form 2^p − 1, found by distributed search, and the record has passed 40 million digits. New ones are found every few years.
Why only check up to the square root?
Because any factor above the square root pairs with one below it, so it would already have been found.

Related pages

Sources

  1. Calculated on this page — At One Place

How these figures are compiled and checked