Skip to content
ENExplore Calculators

Prime Checker

Test whether a given integer is prime, with trial-division proof.

About Prime Checker

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. This calculator uses trial division: it tests all potential factors from 2 up to √n. If none divide n evenly, n is prime. Trial division is efficient for numbers up to about 10¹⁵.

Formula

Trial division bound

Test divisors d from 2 to floor(√n). If none divide n, n is prime.

n
Number to test
d
Trial divisor

Worked example

With the default values below, Prime Checker returns Is Prime? of Yes. Change any input above and every figure here is recalculated in your browser.

Inputs used

Numberminimum 1
97

Results

Is Prime?
Yes
Smallest Factor
N/A (prime)

Step by step

  1. 1Trial division
  2. 2Conclusion= 97 is prime

Assumptions and limits

  • The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Is 1 prime?

No. By convention, 1 is neither prime nor composite. The smallest prime is 2, which is also the only even prime.

Why only check up to the square root?

If n = a × b and both a and b are greater than √n, then a × b > n — a contradiction. So at least one factor of a composite number must be ≤ √n.

Prime Checker – Calculate Is Prime? & Smallest Factor