Skip to content
FiftyCalc Free calculators for all 50 states

Prime Number Calculator

Test cases replayed : 6 of 6 match · Methodology · No outside source listed

Enter a whole number to find out if it is prime, composite, or neither.

Result

Sample figures

Result—

Trial divisors tested up to (√n rounded down) —

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Prime Number Calculator

Whole number (0 to 1,000,000,000,000): enter a number from 0 to 1,000,000,000,000. Prefilled example: 97.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Whole number (0 to 1,000,000,000,000): enter a number from 0 to 1,000,000,000,000.
  2. Read the result: Result; the panel also shows Trial divisors tested up to (√n rounded down).

How this calculator works

A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. A whole number greater than 1 that is not prime is composite; 0 and 1 are neither.

The calculator uses trial division: if n has a divisor other than 1 and n, one of them is at most √n, so it tests 2 and then every odd number up to √n. If none divides n, n is prime.

Worked example

Whole number (0 to 1,000,000,000,000)97
ResultPrime
Trial divisors tested up to (√n rounded down)9

Frequently asked questions

Is 1 a prime number?

No. A prime needs exactly two positive divisors, and 1 has only one.

Is 2 the only even prime?

Yes. Every other even number is divisible by 2, so it is composite.

Is 91 prime?

No. 91 = 7 × 13.

Related calculators