Maths & numbers

Prime number test calculator

Check whether a whole number has a nontrivial divisor.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A composite integer has a factor at or below its square root. If both factors were larger, their product would exceed the number.

THE FORMULATest divisors up to √n

A worked example

97 has no divisor between 2 and 9, so it is prime.

Good to know

Numbers below 2 are neither prime nor composite.

Read the result

Check whether a whole number has a nontrivial divisor.

The primary result is labeled “Classification”. Keep the input definitions in view when comparing this result with another method.

Try a related calculation

Numbers below 2 are neither prime nor composite.

For a related exercise, try the greatest common divisor.

A few questions, answered

How can I check the default inputs by hand?

97 has no divisor between 2 and 9, so it is prime.

Which rule does this calculator apply?

Test divisors up to √n

Find your calculator

Start typing to explore the library.