Prime Number Calculator

Check whether a number is prime, list all of its divisors, and see its prime factorisation along with the nearest primes on either side.

Fill in the fields above and select Calculate to see your result and the full working.

Formula used

A number n is prime if no integer from 2 to √n divides it exactly

How to use this calculator

  1. Enter a whole number of 2 or more.
  2. The result tells you whether it is prime and, if not, how it factorises.
  3. The nearest primes either side are useful when you need a prime close to a target value.

Example calculation

Is 9,973 prime?

√9,973 ≈ 99.9, so we test divisors up to 99

None divide it exactly, so 9,973 is prime.

By contrast 9,975 = 3 × 5² × 7 × 19, so it is composite.

What does this result mean?

Primes are the building blocks of arithmetic: every integer above 1 factorises into primes in exactly one way, which is the fundamental theorem of arithmetic. Testing only up to the square root is sufficient because factors come in pairs — if n has a factor above √n, it must also have a matching one below.

Frequently asked questions

Is 1 a prime number?
No. Primes are defined as having exactly two distinct divisors, and 1 has only one. Excluding it also keeps prime factorisation unique.
Is 2 really prime?
Yes, and it is the only even prime, because every other even number is divisible by 2.
Why do primes matter outside mathematics?
Public-key cryptography relies on the fact that multiplying two large primes is easy while factoring the product back is computationally hard.

Related calculators

More in Mathematics

Browse the Mathematics category or the full calculator directory.