✨ Arithmetic Solver

Prime Number Checker - Is It Prime?

Check if an integer is prime or composite using trial division, with nearby prime numbers for reference.

Number to Test

Enter values to calculate instant result

â„šī¸ Info
💡 Try:
Verified Solution

---

📖

How to Use & Educational Guide

In-depth guide for Prime Number Checker

Educational Overview

What Is a Prime Number?

A prime number is a whole number greater than 1 that has exactly two positive factors: 1 and the number itself. For example, 7 is prime because its only positive factors are 1 and 7.

A number greater than 1 that has more than two positive factors is called a composite number. For example, 12 is composite because it can be divided evenly by 1, 2, 3, 4, 6, and 12.

How to Check if a Number Is Prime

You do not need to test every number below a given integer. To check whether a number is prime, test whether any prime number up to its square root divides it evenly.

1. Make sure the number is a whole number greater than 1.

2. Find the square root of the number.

3. List the prime numbers that are less than or equal to that square root.

4. Divide the original number by each of those primes.

5. If any division has a remainder of 0, the number is composite.

6. If none of the tested primes divides it evenly, the number is prime.

Prime Number Example: Is 97 Prime?

Let us check whether 97 is a prime number using the square-root method.

Step 1: Find the square root of 97. The square root is approximately 9.85, so we only need to test prime numbers up to 9.

√97 ≈ 9.85

Step 2: The prime numbers up to 9 are 2, 3, 5, and 7.

Step 3: Test 97 with each prime. It is not divisible by 2 because it is odd. Its digits add to 16, so it is not divisible by 3. It does not end in 0 or 5, so it is not divisible by 5.

Step 4: Check 7. Since 7 × 13 = 91, the remainder is 6, so 7 does not divide 97 evenly.

97 ÷ 7 = 13 remainder 6

Conclusion: None of the prime numbers up to √97 divides 97 evenly. Therefore, 97 is a prime number.

Prime Number vs. Composite Number

The key difference is the number of positive factors. A prime number has exactly two, while a composite number has more than two.

11 → factors: 1, 11 → Prime
12 → factors: 1, 2, 3, 4, 6, 12 → Composite

Special Cases: 0, 1, and 2

Some small numbers need special attention. 1 is neither prime nor composite because it has only one positive factor. Zero is also neither prime nor composite. The number 2 is the smallest prime number and the only even prime number.

1 → Neither prime nor composite
2 → Prime
0 → Neither prime nor composite

Finding the Next or Nearby Prime

To find the next prime number after a given integer, test the following whole numbers one at a time. For each candidate, apply the prime-number test until you find a number with no prime divisor up to its square root.

For example, after 20, the next number is 21, which is composite because 3 divides 21 evenly. The next number, 22, is also composite because it is divisible by 2. The next number, 23, is prime, so 23 is the next prime after 20.

Prime Number Checking Rule

For a number n > 1, it is enough to test prime divisors up to √n. If no prime number in that range divides n evenly, n is prime.

Test prime divisors ≤ √n

This works because if a composite number has a factor greater than its square root, it must also have a corresponding factor smaller than its square root. Therefore, finding no divisor up to √n is enough to establish that the number is prime.

Common Mistakes to Avoid

  • Calling 1 prime: 1 has only one positive factor, so it is neither prime nor composite.
  • Testing every number unnecessarily: You only need to test prime divisors up to the square root of the number.
  • Forgetting 2: 2 is prime even though it is even; it is the only even prime number.
  • Confusing factors with multiples: A factor divides a number evenly, while a multiple is produced by multiplying a number by an integer.
  • Ignoring the remainder: A number is composite when a valid divisor produces a remainder of 0.
  • Assuming a large number is automatically composite: Size alone does not determine whether a number is prime.

Why Use a Prime Number Calculator?

A prime number calculator can quickly check whether an integer is prime or composite and show the divisibility tests used to reach the result. It can also help identify nearby prime numbers, making it useful for checking answers and learning how prime-number tests work.

Mathematical accuracy verified by AptCalc Engine

Frequently Asked Questions (FAQs)

Answers to common questions about this calculator

What is a prime number?
A prime number is a whole number greater than 1 with exactly two positive factors: 1 and the number itself. Examples include 2, 3, 5, 7, and 11.
How do you check if a number is prime?
Find the square root of the number and test whether any prime number up to that square root divides it evenly. If none does, the number is prime.
Is 1 a prime number?
No. 1 is neither prime nor composite because it has only one positive factor. A prime number must have exactly two distinct positive factors.
What is the only even prime number?
2 is the only even prime number. Every other even number is divisible by 2 and therefore has more than two positive factors.
What is the difference between a prime and a composite number?
A prime number has exactly two positive factors, while a composite number has more than two positive factors. For example, 7 is prime and 12 is composite.
Explore More Tools

Discover Other Calculation Suites

Browse our full ecosystem of precision calculation and conversion tools