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
- Percentage calculator Work out a percentage of a number, what percent one number is of another, and percentage change.
- Loan and EMI calculator Monthly payment, total interest and total repaid for any loan amount, rate and term.
- BMI calculator Body mass index from height and weight, in metric or imperial, with what the number does and does not mean.
- Tip calculator Work out a tip and split the bill, with the per-person figure rounded sensibly.
- Age calculator Exact age in years, months and days from a date of birth, plus total days and the next birthday.
- Paint calculator How much paint a room needs, allowing for doors, windows and the number of coats.
- Compound interest calculator Growth of a lump sum plus regular contributions, with the interest shown separately.
- Calorie and BMR calculator Resting metabolic rate and daily calorie needs by activity level.
- Dog age calculator A dog's age in human years, using the research formula rather than multiplying by seven.
- Discount calculator Find the sale price and how much you save, including stacked discounts and tax.
Sources
- Calculated on this page — At One Place