Prime Number Calculator
Test whether a number is prime, and find the primes on either side of it.
A prime has exactly two divisors: one and itself.
How the prime number calculator works
A prime has exactly two divisors: one and itself. One is not prime — it has only a single divisor — and that exclusion is what makes prime factorisation unique.
Testing is quick because a composite number must have a factor no larger than its square root. Checking 2, then odd numbers up to √n, settles the question in a few dozen steps even for numbers in the millions.
Formula: n is prime if no integer from 2 to √n divides it
Worked examples
| Inputs | Prime? | Note |
|---|---|---|
| Is 97 prime? | Yes, 97 is prime | yes |
| Is 91 prime? | No, 91 is not prime | no — 7 × 13 |
| Is 1 prime? | No, 1 is not prime | no, by definition |
FAQFrequently asked questions
Is 1 a prime number?
No. A prime has exactly two distinct divisors; one has only itself. Excluding it is what makes every number factor into primes in exactly one way.
Is 2 prime?
Yes — and it is the only even prime, since every other even number is divisible by 2.
How do I check if a number is prime?
Try dividing by 2, then by odd numbers up to its square root. If none divide it, it is prime.
Why only up to the square root?
Because if n = a × b and both were larger than √n, their product would exceed n.
What is the largest known prime?
A Mersenne prime with over 41 million digits, found in 2024. Numbers that size are tested with specialised algorithms, not trial division.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Australian Curriculum (ACARA) — Mathematics — the terms and methods taught in Australian schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.