How to Check if a Number Is Prime: Formula, Examples and Prime Number Calculator

Prime Number Calculator

Prime numbers are some of the most important numbers in mathematics. 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

But 8 is not prime because it can be divided evenly by:

1, 2, 4 and 8

A Prime Number Calculator quickly checks whether a number is prime or composite, saving you from testing possible factors manually.


What Is a Prime Number?

A prime number must satisfy two conditions:

1 — It must be greater than 1

2 — It must have exactly two positive factors

Those factors are:

1 and the number itself

Examples of prime numbers include:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29


Is 1 a Prime Number?

No.

1 is NOT prime.

Why?

A prime number needs exactly two distinct positive factors.

But 1 has only one positive factor:

1

Therefore:

1 is neither prime nor composite.

This is one of the most important facts to explain in this guide.


Is 2 a Prime Number?

Yes.

The factors of 2 are:

1 and 2

That means 2 has exactly two positive factors.

Therefore:

2 IS PRIME

It also has a special distinction:

2 is the only even prime number.

Every other even integer greater than 2 is divisible by 2 and therefore composite.


Prime vs Composite Numbers

Whole numbers greater than 1 can be classified as prime or composite.

Prime Number

Has exactly two positive factors.

Example:

7

Factors:

1, 7

Therefore:

7 = PRIME

Composite Number

Has more than two positive factors.

Example:

12

Factors:

1, 2, 3, 4, 6, 12

Therefore:

12 = COMPOSITE


Example 1 — Is 17 Prime?

Test possible factors.

17 is not divisible evenly by:

2

3

4

Its only positive factors are:

1 and 17

Therefore:

17 IS PRIME


Example 2 — Is 21 Prime?

21 can be divided by:

3

because:

21 ÷ 3 = 7

So its factors include:

1, 3, 7, 21

Therefore:

21 IS COMPOSITE


Example 3 — Is 29 Prime?

29 has no positive divisors other than:

1 and 29

Therefore:

29 IS PRIME


Example 4 — Is 100 Prime?

100 is divisible by many numbers.

For example:

100 ÷ 2 = 50

Therefore, we already know it has factors other than 1 and 100.

So:

100 IS COMPOSITE


Quick Prime Number Table

Here are the prime numbers below 100:

RangePrime Numbers
1–102, 3, 5, 7
11–2011, 13, 17, 19
21–3023, 29
31–4031, 37
41–5041, 43, 47
51–6053, 59
61–7061, 67
71–8071, 73, 79
81–9083, 89
91–10097

There are:

25 prime numbers below 100


How Do You Check Whether a Number Is Prime?

For a small number, you could try dividing it by possible factors.

However, there is a useful shortcut.

To determine whether an integer n > 1 is prime, you only need to test possible prime divisors up to:

√n

Why?

If a composite number has a factor larger than its square root, it must also have a corresponding factor smaller than its square root.

So if no integer divisor from 2 through √n divides the number evenly, the number is prime.


Example — Is 97 Prime?

Calculate approximately:

√97 ≈ 9.85

So we only need to test prime divisors up to 9.85:

2, 3, 5 and 7

97 is not evenly divisible by any of them.

Therefore:

97 IS PRIME

There is no need to test every number from 2 through 96.


A Simple Prime-Checking Method

For an integer greater than 1:

STEP 1

If the number is 2, it is prime.

STEP 2

If it is an even number greater than 2, it is composite.

STEP 3

Check possible prime divisors up to √n.

STEP 4

If any divides evenly, the number is composite.

STEP 5

If none divides evenly, the number is prime.


Prime Factorization Is Different

A Prime Number Calculator answers:

“Is this number prime?”

A Prime Factorization Calculator answers:

“Which prime numbers multiply together to make this number?”

For example:

60 is not prime.

Its prime factorization is:

60 = 2² × 3 × 5

These are related concepts, but they answer different questions.


Interesting Prime Number Facts

🔢 2 is the only even prime.

🔢 1 is neither prime nor composite.

🔢 There are infinitely many prime numbers.

🔢 Every integer greater than 1 is either prime or can be expressed as a product of primes.

That last property is the basis of the Fundamental Theorem of Arithmetic.


Where Are Prime Numbers Used?

Prime numbers are important in:

🔢 Mathematics — number theory and factorization.

🔐 Cryptography — many encryption methods rely on properties of large prime numbers.

💻 Computer Science — algorithms, hashing and mathematical computation.

📚 Education — learning factors, multiplication and divisibility.

🧮 Problem Solving — simplifying many mathematical questions.

📊 Number Analysis — understanding the structure and properties of integers.


How to Use the Prime Number Calculator

Using your LivingToolsGuide calculator is easy:

1 — Enter a Whole Number

Example:

97

2 — Click Calculate

3 — View the Result

Result:

✅ 97 IS A PRIME NUMBER

Another example:

100

↓

❌ 100 IS NOT PRIME

Because:

100 = 2 × 50


Check a Prime Number

Want to know whether a number is prime?

For more information about prime numbers and their mathematical properties, see the Prime Number reference from Wolfram MathWorld.

Use our Prime Number Calculator to instantly check whether an integer is prime or composite.

The Prime Number Calculator makes it easy to check numbers quickly and confirm whether they are prime or composite.

👉 Use the Prime Number Calculator