Skip to main content
CalculatorAnything
Popular
Mortgage CalculatorPercentage CalculatorAge CalculatorBMI CalculatorGPA CalculatorWork Hours Calculator
Categories
Finance Business Percentage Date & Time Health Math Everyday Construction
All Calculators About

Prime Number Calculator

Check whether a number is prime, or list all prime numbers up to a given limit.

What do you want to do?

What is a prime number?

A prime number is a whole number greater than 1 that has exactly two positive factors: 1 and itself. For example, 7 is prime because its only positive factors are 1 and 7. By contrast, 12 is composite because it can also be divided evenly by 2, 3, 4 and 6.

The calculator can check one whole number or generate a list of prime numbers up to a limit. Use the first mode when you want a direct prime-or-composite answer, and the second when you want to explore a range.

How to use the Prime Number Calculator

  1. Choose Check if a Number is Prime or List Primes up to a Limit.
  2. Enter a whole number. Example placeholders are shown lightly and are not submitted as values.
  3. Select Calculate.
  4. For a prime number, the result also shows its prime position and neighboring primes.

How the prime check works

For a number n, it is enough to test possible divisors from 2 through √n. If a composite number has a factor larger than its square root, the matching factor in that pair must be smaller than the square root. Finding no divisor in that smaller range is therefore enough to establish primality.

n is prime when no integer d, 2 ≤ d ≤ √n, divides n evenly.

Worked example: Is 97 prime?

√97 is approximately 9.85, so we only need to test prime divisors up to 9.85: 2, 3, 5 and 7.

  • 97 is not even, so it is not divisible by 2.
  • 9 + 7 = 16, so it is not divisible by 3.
  • It does not end in 0 or 5, so it is not divisible by 5.
  • 97 ÷ 7 is not a whole number.

None of the required divisors divide 97 evenly, so 97 is prime. It is the 25th prime number; the previous prime is 89 and the next is 101.

Prime numbers from 1 to 100

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

There are 25 prime numbers between 1 and 100. Notice that 1 is not included, and 2 is the only even prime.

Prime numbers vs. composite numbers

A whole number greater than 1 is either prime or composite. Prime numbers have exactly two positive factors. Composite numbers have more than two. The number 1 is a special case: it is neither prime nor composite.

Assumptions and limits

  • The checker accepts whole numbers 2 or greater. Decimals, negative values, 0 and 1 are not prime inputs.
  • The list mode is capped at 10,000 and displays at most 200 primes to keep the browser result readable.
  • This tool is intended for everyday and educational prime-number checks, not specialized large-integer cryptographic primality testing.

Tips and common mistakes

  • You only need to test divisors up to the square root: for 97, checking 2, 3, 5 and 7 is enough because √97 ≈ 9.8.
  • Every prime above 3 is one more or one less than a multiple of 6 (like 97 = 96 + 1), but not every such number is prime (25 = 24 + 1).
  • List mode shows up to 200 primes; for larger limits, narrow the range.
  • 1 is not prime, and 2 is the only even prime.

Frequently Asked Questions

Why isn't 1 a prime number?

A prime number must have exactly two distinct positive factors: 1 and itself. The number 1 has only one positive factor, so it is neither prime nor composite.

Is 2 a prime number?

Yes. Its only positive factors are 1 and 2. It is also the only even prime number because every other even whole number greater than 2 is divisible by 2.

Why do you only test divisors up to the square root?

Factors come in pairs. If one factor is larger than √n, its paired factor must be smaller than √n. So any composite number will reveal a divisor by the time the test reaches its square root.

Are negative numbers prime?

No. In the usual definition used in elementary number theory, prime numbers are positive integers greater than 1.

Is there a largest prime number?

No. There are infinitely many prime numbers, so there is no largest prime.

What is the difference between a prime number and a prime factor?

A prime number is a number with exactly two positive factors. A prime factor is a prime number that divides another number evenly; for example, 2 and 3 are prime factors of 12.

How large a number can I check?

Whole numbers up to one trillion (10^12). Larger values exceed what a browser can check quickly and exactly.

Related Calculators

GCF CalculatorLCM CalculatorRandom Number Calculator