Prime Number Calculator (Is It Prime?)

Check whether a number is prime, find its smallest factor, the next and previous prime, or list all the primes in a range.

From 0 up to 1,000,000,000,000 (10¹²).

Results

Is 91 prime?
No, 91 is not prime
Smallest factor (other than 1)
7
Its partner is 13.
Working
91 ÷ 7 = 13 exactly, so 7 is a factor. Smaller divisors were tested first, so 7 is the smallest factor. That makes 91 = 7 × 13 (a composite number).
Next prime after it
97
Previous prime before it
89

How it’s calculated

A prime number is a whole number greater than 1 whose only factors are 1 and itself. Anything else above 1 is composite. To test a number n you only need to try dividing by whole numbers up to its square root: if n had a factor larger than that, its partner factor would be smaller than the square root and would already have been found.

n is prime ⇔ n ≥ 2 and no whole number from 2 to √n divides n exactly

To list primes in a range the calculator uses the sieve of Eratosthenes: write out the numbers, then cross out every multiple of 2, of 3, of 5 and so on. The numbers left standing are the primes.

Example: is 91 prime? √91 is about 9.5, so test 2, 3, 5, 7. 2, 3 and 5 do not divide 91, but 91 ÷ 7 = 13. So 91 is not prime: its smallest factor is 7 and 91 = 7 × 13. The nearest primes are 89 below and 97 above. (Many people guess 91 is prime because it passes the quick tests for 2, 3 and 5.)

This page answers "is it prime?" and finds neighboring primes. To see a number split completely into primes, or all of its factors, use the prime factorization or factors calculators.

Frequently asked questions

Is 1 a prime number?

No. A prime needs exactly two different factors, and 1 has only one. Treating 1 as non-prime is also what makes prime factorization unique.

Is 2 prime?

Yes, and it is the only even prime. Every other even number is divisible by 2, so it has at least three factors.

How many primes are there below 100?

There are 25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. Try the range option to see them.

How large a number can I check?

Up to 1,000,000,000,000 (10¹²) for a single number, which needs at most a few hundred thousand divisions. Ranges can end at 10,000,000.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator