Prime Number Checker - Is It Prime?
Check if an integer is prime or composite using trial division, with nearby prime numbers for reference.
---
Visual Graph & Diagram
Interactive mathematical coordinate representation
Calculation Reference Table
Benchmark values and quick reference intervals
Recommended Final Steps
Step-by-Step Mathematical Solution
How to Use & Educational Guide
In-depth guide for Prime Number Checker
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.
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.
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.
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.
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.
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?
How do you check if a number is prime?
Is 1 a prime number?
What is the only even prime number?
What is the difference between a prime and a composite number?
Discover Other Calculation Suites
Browse our full ecosystem of precision calculation and conversion tools
Mathematics Suite
Percentages, Algebra, Fractions, Geometry, and step-by-step math solvers.
Date & Time Tools
Days ago, days from today, business days, and calendar date calculators.
Unit Converter
Convert length, weight, volume, temperature, and international units.
Countdown Tracker
Live real-time event countdowns, holidays, and deadline trackers.
Explore Related Calculators
More tools in Arithmetic
Addition Calculator
Step-By-Step Solver
Subtraction Calculator
Step-By-Step Solver
Multiplication Calculator
Step-By-Step Solver
Division Calculator
Step-By-Step Solver
Long Division Calculator
Step-By-Step Solver
Order of Operations Calculator (PEMDAS/BODMAS)
Step-By-Step Solver