Overview

A prime number has exactly two divisors: 1 and itself. Primes are the building blocks of all whole numbers and the basis of modern encryption.

Enter a number to check if it is prime, see its prime factors if not, and find the nearest primes on either side.

Worked examples

InputsResult
Number9797 is a prime numberPrevious prime: 89Next prime: 101
Show 3 more examples
Number22 is a prime numberPrevious prime: noneNext prime: 3
Number221221 is compositePrime factors: 13 × 17Previous prime: 211Next prime: 223
Number7,9197,919 is a prime numberPrevious prime: 7907Next prime: 7927

Result (is) by number

With the calculator's starting values, the result is 97 is a prime number. The table shows how it changes with the number.

NumberResult (is)
6060 is composite
8080 is composite
97starting value97 is a prime number
100100 is composite
120120 is composite
140140 is composite

How it works

The check tries every divisor up to the square root of the number; if none divides it evenly, the number is prime. Prime factorization repeatedly divides out the smallest factor.

The formula

n is prime if no integer d with 2 ≤ d ≤ √n divides n
nThe number to test

Practical tips

  • 2 is the only even prime.
  • A quick filter: a number ending in 0, 2, 4, 5, 6 or 8 (except 2 and 5) is not prime.

Frequently asked questions

Is 1 a prime number?

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

How many primes are there below 100?

25.