Prime Number Calculator

Prime Number Calculator | Check if a Number is Prime

Prime Number Calculator

Check instantly whether any whole number is prime or composite, see all factors, and find neighboring primes.

Prime Number Checker
Please enter a valid whole number greater than 0.
Previous Prime
Next Prime
How We Checked This

First 100 Prime Numbers

Prime numbers from 2 through 541. There are exactly 100 primes in this range. Click any to check it in the calculator above.

Prime Numbers 1 to 1000

There are 168 prime numbers between 1 and 1000.

What Is a Prime Number?

A prime number is any whole number greater than 1 that has exactly two factors: 1 and the number itself. Because it cannot be divided evenly by any other whole number, a prime is considered mathematically indivisible in the context of multiplication.

Prime vs Composite Numbers

Every whole number greater than 1 falls into one of two categories. A prime number has exactly two factors. A composite number has three or more factors, meaning it can be broken down into smaller whole-number building blocks. The number 1 is in a special category by itself because it has only one factor.

Why 2 Is the Only Even Prime

Two is prime because its only factors are 1 and 2. Every other even number is divisible by 2 in addition to 1 and itself, giving it at least three factors, which makes it composite. This makes 2 uniquely the only even prime number in all of mathematics.

Examples of Prime and Composite Numbers

Prime: 7 has factors 1 and 7 only. It cannot be divided evenly by 2, 3, 4, 5, or 6.
Composite: 12 has factors 1, 2, 3, 4, 6, and 12. It can be divided evenly by 2, 3, 4, and 6.
Neither: 1 has only one factor (itself) so it is neither prime nor composite.

How to Check if a Number Is Prime

Checking primality by hand is straightforward using the square root method. This approach is efficient because any factor pair of a number must include one value less than or equal to the square root.

If n has no prime divisors up to √n, then n is prime

The Square Root Method Step by Step

Step 1: Calculate the square root of your number. Step 2: List all prime numbers up to that square root. Step 3: Divide your number by each prime in the list. Step 4: If none divide evenly, your number is prime.

Worked Example: Is 127 Prime?

Square root of 127 is approximately 11.27.
Primes to check: 2, 3, 5, 7, 11
127 ÷ 2 = 63.5   127 ÷ 3 = 42.33   127 ÷ 5 = 25.4
127 ÷ 7 = 18.14   127 ÷ 11 = 11.55
None divide evenly, so 127 is prime.

Worked Example: Is 91 Prime?

Square root of 91 is approximately 9.54.
Primes to check: 2, 3, 5, 7
91 ÷ 7 = 13 exactly.
91 is composite with factors 1, 7, 13, and 91.

Why Prime Numbers Matter

Prime Numbers as Building Blocks

Prime numbers are the fundamental building blocks of all whole numbers. The Fundamental Theorem of Arithmetic states that every integer greater than 1 can be expressed as a unique product of prime numbers. Just as atoms combine to form all matter, primes combine through multiplication to form every composite number.

Prime Numbers in Computer Security

Modern encryption systems rely heavily on prime numbers. RSA encryption, which secures internet transactions and private communications, works by multiplying two very large prime numbers together. The resulting product is easy to compute but practically impossible to factor back into the original primes without knowing them. This mathematical difficulty is the foundation of public-key cryptography.

Prime Numbers in Nature and Science

Primes appear naturally in biology and physics. Some cicada species emerge every 13 or 17 years, both prime numbers, which is thought to help them avoid synchronizing with the life cycles of predators. Prime gaps and the distribution of primes along the number line remain one of the most active areas of research in pure mathematics.

Frequently Asked Questions

A prime number is a whole number greater than 1 that has exactly two factors: 1 and itself. Examples include 2, 3, 5, 7, 11, and 13. A number with more than two factors is called a composite number.

No, 1 is not a prime number. By definition, a prime number must have exactly two distinct factors. The number 1 has only one factor, which is itself, so it does not qualify as prime. It is also not classified as composite.

Yes, 2 is a prime number. It is the only even prime number because all other even numbers are divisible by 2 and therefore have more than two factors.

To check if a number is prime, find its square root and then test whether it is divisible by any prime number less than or equal to that square root. If no such divisor exists, the number is prime. For example, to test 97, the square root is about 9.85, so you only need to check divisibility by 2, 3, 5, and 7.

A composite number is a whole number greater than 1 that has more than two factors, meaning it can be divided evenly by at least one number other than 1 and itself. For example, 12 is composite because its factors are 1, 2, 3, 4, 6, and 12.

There are 25 prime numbers between 1 and 100. They are: 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.