Prime Number Checker

Enter a whole number, then press Check if it is prime.

Prime Number Checker: Check Whether a Number Is Prime or Composite

My daughter came home with a homework question last year: is 97 a prime number? I looked at it and thought yes, probably, but I could not prove it. I typed 97 into the Prime Number Checker, and it said 97 is prime, then showed me the factors and the steps behind the answer. That was the first time I understood what a prime number really is: a number with exactly two factors, 1 and itself, and nothing else. This guide is the way I actually use it, first the tool as it really is, then every definition, method and worked example I reach for when the tool stops and the math starts.

At a glance:

  • The Prime Number Checker takes one number and tells you whether it is prime or composite.
  • It lists all the factors of the number and counts them to prove the answer.
  • The examples in this guide are 17, which is prime, and 18, which is not.
  • It does not generate a list of primes, run the Sieve, or use Miller-Rabin. Those are worked by hand in this guide.

What Is a Prime Number?

A Prime Number Checker is a tool that takes a number and tells you whether it is prime or composite, with the factors to prove it. A prime number is a whole number greater than 1 that has exactly two factors: 1 and itself.

Definition of a Prime Number

A prime number is a whole number greater than 1 whose only factors are 1 and itself. The number 4 is not prime because its factors are 1, 2 and 4. The definition has two parts: greater than 1, and exactly two factors. The prime number article on Wikipedia sets out the definition, the history and the open questions in full.

Prime Numbers vs. Composite Numbers

A composite number is a whole number greater than 1 that has more than two factors. The number 18 is composite because its factors are 1, 2, 3, 6, 9 and 18. The number 17 is prime because its factors are only 1 and 17. Every whole number greater than 1 is either prime or composite, and there is no third kind. The smallest prime is 2, and the smallest composite is 4. I check the factors first, because the factor list is what decides the answer.

Is 1 a Prime Number?

The number 1 is not a prime number, and it is not a composite number either. A prime number must have exactly two factors, but 1 has only one factor, itself. So 1 sits alone, neither prime nor composite, and the tool agrees: type 1 into the Prime Number Checker and it says 1 is not prime, because prime numbers are 2 or greater. The reason 1 is excluded is practical: if 1 were prime, every number would have infinitely many prime factorizations, and the fundamental theorem of arithmetic would fall apart.

Understanding Factors and Divisibility

A factor is a number that divides another number exactly, with no remainder. The factors of 18 are 1, 2, 3, 6, 9 and 18, because each one divides 18 with no remainder. The Prime Number Checker lists all the factors of the number you type in, which is how it proves the answer. For the factors of two numbers at once, and their greatest common factor, the GCF and LCM Calculator works it out directly.

How to Use the Prime Number Checker?

I have run dozens of numbers through this Prime Number Checker, and the routine never changes. Type the number, press Check, and read the answer with the factors and the test underneath.

Enter an Integer to Check

Type the number you want to check into the single box. The box already holds 29 when the page opens, so change it to your own number before you press Check. The tool floors your number to a whole number, so 17.9 becomes 17, and a negative number gets a message asking for a whole number of 1 or more.

View the Prime or Composite Result

Press Check, and the answer appears in bold at the top: either “17 is prime” or “18 is not prime”. For 17, the tool says it is prime. For 18, it says it is not prime. The answer never hedges, because a number is either prime or it is not, and the tool decides from the factor list.

Understand the Reason Behind the Result

Below the answer, the tool shows a steps panel with the factors and the count. For 17, the steps read: Factors of 17: 1, 17. 17 has exactly two factors (1 and itself), so it is prime. For 18, the steps read: Factors of 18: 1, 2, 3, 6, 9, 18. 18 has 6 factors, so it is not prime. The tool also notes that 18 is divisible by 2.

Copy and Use Your Results

The tool has no copy button, so copy the answer and the factors by hand. I write the number, the answer, and the factors, because a bare “prime” or “not prime” is not enough for homework: the teacher wants the working. For a list of primes in a range, use the generator section of this guide, because the tool tests a single number.

How Does a Prime Number Checker Work?

The Prime Number Checker works by listing the factors and counting them, and nothing else. The sections below explain the test, so you can do it by hand when the tool is not there.

Understanding Primality Testing

Primality testing is the job of deciding whether a number is prime, and the Prime Number Checker does it by listing every factor and counting them. To test 97 by hand, test the divisors up to √97, which is about 9.848858. The divisors to test are the primes up to 9: 2, 3, 5 and 7. None of them divides 97, so 97 is prime.

How to Identify Prime Numbers?

To identify a prime number by hand, test the small primes first. Check 2: if the number is even and larger than 2, it is not prime. Check 3: if the digits add to a multiple of 3, the number is divisible by 3. The number 91 looks prime, but 91 = 7 × 13, so it is not. I check the small primes first, because most composite numbers fall at 2, 3 or 5.

Checking Divisibility and Factors

Divisibility rules are the shortcuts for finding factors. A number is divisible by 2 if it is even, by 3 if its digits add to a multiple of 3, and by 5 if it ends in 0 or 5. The number 51 has digits that add to 6, so it is divisible by 3, and 51 ÷ 3 = 17, so 51 = 3 × 17. The Prime Number Checker does not use these rules: it lists every factor by looping from 1 to the number itself, which is why it is slow for very large numbers.

Testing Large Numbers for Primality

Testing a large number for primality is hard, because trial division gets slower as the number grows. The tool loops from 1 to the number itself, so a number with 10 digits would take far too long. The Prime Number Checker is for the numbers you meet in school and homework, not for the record books.

Types of Prime Numbers and Their Properties

Prime numbers come in kinds, and each kind has its own pattern. The Prime Number Checker does not sort them into kinds: it only says prime or not prime.

Even and Odd Prime Numbers

The number 2 is the only even prime number, because every other even number is divisible by 2. All other prime numbers are odd: 3, 5, 7, 11, 13, 17, 19, 23, 29, and so on. The sum of two odd primes is always even, because odd plus odd is even: 3 + 5 = 8, and 11 + 13 = 24. The sum of 2 and an odd prime is always odd, because even plus odd is odd: 2 + 3 = 5, and 2 + 11 = 13.

Twin Prime Numbers

Twin primes are pairs of primes that differ by 2. The pairs are (3, 5), (5, 7), (11, 13), (17, 19), (29, 31) and (41, 43). The tool does not find twin primes, because it checks one number at a time, but you can check both numbers of a pair and see that each one is prime.

Mersenne Prime Numbers

A Mersenne prime is a prime of the form 2^p − 1, where p is itself prime. The first ones are 2^2 − 1 = 3, 2^3 − 1 = 7, 2^5 − 1 = 31, 2^7 − 1 = 127 and 2^13 − 1 = 8191. Not every Mersenne number is prime: 2^11 − 1 = 2047, which is 23 × 89, so it is composite. For the powers themselves, the Exponent Calculator works out 2^p for any p, and the Mersenne test is whether the result minus 1 is prime.

Co-Prime Numbers

Co-prime numbers are two numbers whose greatest common divisor is 1, which means they share no factor other than 1. The numbers 8 and 15 are co-prime, because 8 = 2 × 2 × 2 and 15 = 3 × 5, and they share no factor. The numbers 12 and 18 are not co-prime, because they share 6. Co-prime is not the same as prime: 8 and 15 are both composite, but they are co-prime to each other. The Prime Number Checker does not test co-primality, because it checks one number at a time.

Other Interesting Prime Number Patterns

Prime numbers have patterns that are easy to see and hard to prove. There are 25 primes below 100, and the largest gap below 100 is between 89 and 97, a gap of 8. The first six primes, 2, 3, 5, 7, 11 and 13, add to 41, which is itself prime. Goldbach’s conjecture says every even number greater than 2 is the sum of two primes: 10 = 3 + 7, and 20 = 3 + 17.

Prime Number Testing Methods and Algorithms

There are three ways to test primality. Trial division is exact and slow, the Sieve is for lists, and Miller-Rabin is for large numbers. The Prime Number Checker lists every factor and counts them.

Trial Division Method

Trial division is the by-hand method: divide the number by every prime up to its square root, and if none divides it, the number is prime. To test 97, divide by 2, 3, 5 and 7, because √97 is about 9.85. None of the four divides 97, so the number is prime. For the division itself, the Long Division Calculator works out the quotient and the remainder, and a remainder of 0 means the number divides exactly.

Sieve of Eratosthenes

The Sieve of Eratosthenes finds all the primes up to a limit by crossing out the multiples. To find the primes up to 30, write 2 to 30, cross out the multiples of 2, then the multiples of 3, then the multiples of 5, and what is left is prime: 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. The tool does not run the Sieve, because it tests a single number, so use the Sieve when you need a list and the tool when you need one answer.

Miller-Rabin Primality Test

The Miller-Rabin test is a probabilistic test for large numbers: it tests a few bases, and if the number passes them all, it is almost certainly prime. The tool does not use Miller-Rabin, because it lists every factor and counts them, which is exact but slow.

Comparing Different Primality Testing Methods

Trial division, the Sieve and Miller-Rabin each suit a different job. Trial division is exact and simple. The Prime Number Checker lists every factor instead, but it is slow for large numbers, because the tool loops from 1 to the number itself.

Prime Number Examples and Interesting Facts

Examples are how prime numbers become real, and the checker on CalcSolver is the fastest way to check each one.

Prime Numbers From 1 to 100

There are 25 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 and 97. The tool checks any one of these in a second, and the factor list shows why it is prime.

Prime Number Checker with glowing prime cubes standing out in a number grid beside a calculator on a dark navy background
One number in, one answer out: a prime number checker lists every factor and counts them to say prime or composite.

First 10 Prime Numbers

The first 10 prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. The Prime Number Checker on CalcSolver lists the factors for each one. The first 10 are the ones to learn by heart, because they are the divisors you test first.

How to Recognize Prime and Composite Numbers?

To recognize a prime number, look for factors. If a number has no factor other than 1 and itself, it is prime. If it has any other factor, it is composite. The number 97 has no factor other than 1 and 97, so it is prime. The number 91 has 7 and 13 as factors, so it is composite. I check the factor list before I trust the answer, because the list is the proof: two factors means prime, more than two means composite, and one factor means the number is 1.

Largest Known Prime Numbers

The largest known prime number, found in October 2024, is 2^136,279,841 − 1, with 41,024,320 digits. It was found by Luke Durant, and it is a Mersenne prime. The previous record, found in December 2018, was 2^82,589,933 − 1, with 24,862,048 digits. The Prime Number Checker on CalcSolver is for the numbers you meet in school, not for the record books.

Common Misconceptions About Prime Numbers

The most common misconception is that 1 is prime: it is not, because it has only one factor. The second is that all primes are odd: 2 is even and prime. The third is that 9 is prime: it is 3 × 3, so it is composite. The fifth is that prime numbers are rare: there are 25 below 100, and they never stop, because Euclid proved more than 2,000 years ago that there are infinitely many primes. The Prime Number Checker settles each of these in a second, because the factor list does not argue.

Prime Number Generator and Calculator

A generator and a checker do different jobs, and the Prime Number Checker on CalcSolver is the checker. The generator builds a list, and the checker tests one number.

How to Generate a List of Prime Numbers?

To generate a list of prime numbers, use the Sieve of Eratosthenes. Write the numbers from 2 to your limit, cross out the multiples of 2, then the multiples of 3, then the multiples of 5, and what is left is prime. Up to 30, the list is 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. The tool does not generate a list, because it tests a single number, so the Sieve is the method for a list.

Difference Between a Prime Number Checker and Generator

The difference is simple: a checker tests one number, and a generator lists many. The Prime Number Checker takes a number and says prime or not prime, with the factors to prove it. A generator takes a range and returns every prime inside it, with no test for a single number.

Finding Prime Numbers Within a Given Range

To find the primes in a range, run the Sieve up to the top of the range, then take the ones inside it. Between 50 and 100, the primes are 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97, which is 10 primes. The tool cannot do a range, because it checks one number at a time, so check each candidate on the tool, or run the Sieve once and read the list.

Applications of Prime Numbers in Mathematics and Technology

Prime numbers are not just a school topic: they hold up online security, and they sit inside the code that runs the internet. The Prime Number Checker on CalcSolver is the school version of the same math.

Prime Numbers in Number Theory

Number theory is the study of whole numbers, and prime numbers are its building blocks. The fundamental theorem of arithmetic says every whole number greater than 1 is a unique product of primes: 60 = 2 × 2 × 3 × 5, and 84 = 2 × 2 × 3 × 7.

RSA Encryption and Online Security

RSA encryption, which protects online banking and shopping, is built on two large prime numbers. A small example is p = 61 and q = 53, which gives n = 3233. Real RSA uses primes with hundreds of digits, and the security comes from the fact that factoring n back into p and q is too slow for any computer.

Computer Programming and Algorithms

Programming uses prime numbers in hash tables, random number generation and primality testing. A primality test in code is usually trial division for small numbers and Miller-Rabin for large ones, which is the same split this guide makes.

Everyday Mathematical and Educational Uses

Prime numbers show up in homework, exams and everyday math. And every time you log in to a bank or a shop online, prime numbers are working in the background, in the RSA keys. The Prime Number Checker is the homework version of the same idea: type a number, read the factors, and learn why it is prime or not.

Prime Number Checker for Students and Developers

Students and developers use the checker on CalcSolver for different jobs, but the routine is the same: type the number, read the answer, and check the factors.

Verify Homework and Mathematical Problems

To verify homework, type the number into the Prime Number Checker on CalcSolver and compare the answer with your own working. For the division in your working, the Long Division Calculator shows the quotient and the remainder. The factor list is the working, so copy it into your answer: a bare “prime” is not enough, and the teacher wants to see why.

Test Prime Numbers in Programming

To test a prime number in programming, write a trial division loop: for each i from 2 to the square root, check whether the number divides evenly, and if none does, the number is prime. For a large number, use a Miller-Rabin library instead of a loop, because the loop is too slow. The Prime Number Checker on CalcSolver lists every factor and counts them, and it is the simplest primality test a programmer can write.

Check Large Integers for Primality

To check a large integer for primality, do not use trial division: the tool loops from 1 to the number itself, so a number with 10 digits would take far too long. The record prime has 41,024,320 digits, and it was found with a specialized test, not with trial division. It is for the numbers you meet in school and homework, up to a few digits, and for anything larger, use a proper primality test.

Understanding Prime Number Results for Learning

To learn from the results, read the factor list, not just the answer. The answer says prime or not prime, but the factor list says why: 97 has only 1 and 97, so it is prime, and 91 has 7 and 13, so it is not. When you understand the factors and the square root, you can test a number by hand, and the tool becomes a check rather than a crutch.

Frequently Asked Questions

What Is a Prime Number Checker?

It takes a number and tells you whether it is prime or composite, with the factors to prove it. Type a number into the checker on CalcSolver, press Check, and it says either “17 is prime” or “18 is not prime”, with the factor list underneath. It checks one number at a time, and it lists all the factors and counts them.

How Can I Check Whether a Number Is Prime?

Type the number into the Prime Number Calculator and press Check, or test it by hand. By hand, test the small primes first: 2, then 3, then 5, then 7, up to the square root of the number. For 97, test 2, 3, 5 and 7, because √97 is about 9.85, and none of them divides 97, so 97 is prime. For 91, test the same primes, and 7 divides 91, so 91 is not prime.

Why Is 1 Not Considered a Prime Number?

The number 1 is not considered a prime number because it has only one factor, itself. A prime number must have exactly two factors, 1 and itself, and 1 fails that test. So 1 is neither prime nor composite, and the tool agrees: type 1 and it says 1 is not prime, because prime numbers are 2 or greater.

Is 2 the Only Even Prime Number?

Yes, 2 is the only even prime number. Every other even number is divisible by 2, so it has at least three factors: 1, 2 and itself. The number 2 has only 1 and 2, so it is prime. All other prime numbers are odd, and that is why 2 is special: it is the only prime that is even, and the only even number that is prime.

How Do I Know If a Number Is Prime or Composite?

Look at the factor list. If a number has exactly two factors, 1 and itself, it is prime. If it has more than two factors, it is composite. The number 97 has factors 1 and 97, so it is prime. The number 91 has factors 1, 7, 13 and 91, so it is composite.

Can a Prime Number Checker Test Large Numbers?

The tool can test large numbers, but it is slow, because it loops from 1 to the number itself to list every factor. A number with a few digits is fine, but a number with 10 digits would take far too long. For large numbers, use Miller-Rabin, which tests a few bases and gives an answer that is almost certainly right. The biggest known prime has 41,024,320 digits, found with a specialized test rather than trial division. For school and homework numbers, the Prime Number Calculator is fast enough.

What Is the Difference Between a Prime Number and a Co-Prime Number?

A prime number is a property of one number: it has exactly two factors, 1 and itself. A co-prime number is a relationship between two numbers: they share no factor other than 1. The number 17 is prime, because its factors are 1 and 17. Take 8 and 15: 8 = 2 × 2 × 2 and 15 = 3 × 5, so they share no factor and are co-prime. The numbers 8 and 15 are both composite, but they are co-prime to each other.

Are Prime Numbers Used in Encryption?

Yes, prime numbers are used in encryption, in RSA. RSA takes two large prime numbers, multiplies them to get a public key, and the security comes from the fact that factoring the key back into the two primes is too slow for any computer. For example, 61 × 53 = 3233, which is a small RSA key. Every time you log in to a bank or a shop online, prime numbers are working in the background, in the RSA keys.

Can I Generate Prime Numbers Online?

You can generate prime numbers online with a generator, but this tool is a checker, not a generator: it tests one number at a time. A Prime Number Generator takes a range and returns every prime inside it, and the Sieve of Eratosthenes is the method it uses.

References and Further Reading

The prime number article on Wikipedia sets out the definition, the history and the open questions. The Great Internet Mersenne Prime Search, known as GIMPS, is the project that found the largest known prime, 2^136,279,841 − 1, in October 2024. For the US curriculum, the Common Core teaches prime numbers in Grade 4 and factors in Grade 6, and for the UK, the GCSE covers primes, factors and multiples.

Related Math Calculators and Tools

The Prime Number Checker sits well with a small set of neighbors. The GCF and LCM Calculator works out the greatest common factor and the least common multiple, the Exponent Calculator works out the powers for Mersenne primes, and the Long Division Calculator works out the quotient and the remainder for trial division. The Prime Number Calculator is the same tool under its other name, and the Prime Number Generator builds a list where the checker tests one number.

Try your own numbers now on CalcSolver: the homework problem you have been avoiding, the number that looks prime but might not be, or the first 10 primes from memory. The Prime Number Checker does the arithmetic in a second, but the habit of checking the factors is what actually keeps you right.