Prime Number Calculator

Are they prime?
  • Are they prime?
  • nth prime number
  • First n prime numbers
  • Prime numbers between
  • Closest prime number

Hello there!

Please provide your input and click the calculate button
Show Solution Hide Solution

About the Prime Number Calculator

The prime number calculator can do the following tasks for you.

  • Check whether a number is prime. If you provide a list of numbers, it will tell you which (if any) of those numbers are prime.
  • Find the nth\hspace{0.2em} n^\text{th} \hspace{0.2em}prime number.
  • Get the list of first n\hspace{0.2em} n \hspace{0.2em}prime numbers or prime numbers in a certain range.
  • Find the prime numbers closest to a number.

It's a great tool if you are interested in or need to work with prime numbers.

Usage Guide

Show Hide

i. Valid Inputs

When providing input to the first calculator (checking primes), enter a list of upto five positive integers separated by commas.

For the remaining four calculators, each input needs to be a positive integer.

ii. Example

If you would like to see an example of the calculator's working, just click the "example" button.

iii. Share

We would love to see you share our calculators with your family, friends, or anyone else who might find it useful.

By checking the "include calculation" checkbox, you can share your calculation as well.

Here's a quick overview of what prime numbers are and how to check if a number is prime.

For those interested, we have a more comprehensive tutorial on prime numbers.

Prime Numbers

A prime number is a natural numbers greater than 1\hspace{0.2em} 1 \hspace{0.2em} that has only two factors — 1\hspace{0.2em} 1 \hspace{0.2em} and itself.

Natural numbers that are not prime are known as composite numbers.

11 \hspace{0.2em} is neither prime nor composite.

Checking Whether a Number Is Prime

Let me explain an efficient way to check whethr a number is prime using the following example.

Check whether 85\hspace{0.2em} 85 \hspace{0.2em} is a prime number.


Step 1.  Create a list of prime numbers up to the square root of the number you want to test.

Here, our number is 85\hspace{0.2em} 85 \hspace{0.2em}. It's square root would be something between 9\hspace{0.2em} 9 \hspace{0.2em} and 10\hspace{0.2em} 10 \hspace{0.2em} (9\hspace{0.2em} 9 \hspace{0.2em} point something). We don't need the exact square root, just the whole number part. So 9\hspace{0.2em} 9 \hspace{0.2em}

Now, the prime numbers up to 9\hspace{0.2em} 9 \hspace{0.2em} are 2\hspace{0.2em} 2 \hspace{0.2em}, 3\hspace{0.2em} 3 \hspace{0.2em}, 5\hspace{0.2em} 5 \hspace{0.2em}, and 7\hspace{0.2em} 7 \hspace{0.2em}.

Step 2.  Check if the given number is divisible by any of the prime numbers obtained in step 1. If the number isn't divisible, then it is prime. Otherwise, not.

85\hspace{0.2em} 85 \hspace{0.2em} is not divisible by 2\hspace{0.2em} 2 \hspace{0.2em}, 3\hspace{0.2em} 3 \hspace{0.2em}, 5\hspace{0.2em} 5 \hspace{0.2em}, or 7\hspace{0.2em} 7 \hspace{0.2em}. So, 85\hspace{0.2em} 85 \hspace{0.2em} is a prime number.

Share  via

Include calculation