Skip to main content

Prime Number Calculator

Check whether a number is prime or composite instantly. Find prime factors, explore divisibility, and see a step-by-step explanation with our free prime number checker.

Check a Prime Number

Enter a whole number from 0 to 1,000,000,000. Use digits only; results update automatically.

Examples

97 is

Prime

97 has exactly two positive factors: 1 and 97.

Smallest nontrivial divisor
None
Prime factorization
97
Previous prime
89
Next prime
101

Inputs support 0 to 1,000,000,000. Neighbor lookup can extend to 1,000,001,000; previous and next primes are strictly below and above the input.

Step-by-step primality verification

  1. Step 1: Check the definition

    97 > 1

    This number can be tested for primality.

  2. Step 2: Find the square-root bound

    √97 ≈ 9.85; floor(√97) = 9

    If a number is composite, at least one prime divisor is no greater than its square root.

  3. Step 3: Test prime divisors

    97 mod 2 = 1; 97 mod 3 = 1; 97 mod 5 = 2; 97 mod 7 = 6

    No prime divisor up to 9 divides 97 evenly.

  4. Step 4: Read the conclusion

    97 is a prime number

    97 has exactly two positive factors: 1 and 97.

Final answer: 97 is a prime number

Prime factorization of 97

97 = 97

97 is already prime, so its factorization consists of itself.

How to Use the Prime Number Checker

Use this prime number checker to answer “is it a prime number?” and see the arithmetic behind the result.

  1. Enter a whole number from 0 to 1,000,000,000 using digits only. Leading zeros are allowed.
  2. Read the live classification: prime, composite, or neither for 0 and 1.
  3. For a composite, check the smallest nontrivial divisor and its matching factor.
  4. Review the prime factorization and the generated verification steps. Expand the division breakdown for repeated factors.
  5. Compare the previous and next primes, or copy, print or export the complete calculation.

Choose a preset to try a known example. Reset restores 97. Clearing the field removes the answer until you enter another number.

What Is a Prime Number?

A prime number is an integer greater than 1 with exactly two distinct positive divisors: 1 and the number itself. The first five primes are 2, 3, 5, 7 and 11.

For example, 7 cannot be split into a product of two whole numbers that are both greater than 1. Its only positive factor pair is 1 × 7. The number 2 is the only even prime: every other positive even number greater than 2 has an additional divisor, 2.

What Is a Composite Number?

A composite number is an integer greater than 1 with more than two positive divisors. Examples include 4, 6, 8, 9, 10 and 12. One nontrivial factor pair is enough to establish that a number is composite: 91 = 7 × 13.

The number 1 is not composite, because it has only one positive divisor. Zero is also neither prime nor composite. These are separate cases, rather than exceptions that should be forced into one category.

How to Check if a Number Is Prime

To check for a prime number manually, start by excluding 0 and 1. If the number is 2, it is prime. If it is a larger even number, it is composite. For an odd number, try the remaining prime divisors through its square root.

For 97, √97 ≈ 9.85. The possible prime divisors are 2, 3, 5 and 7. Dividing leaves remainders 1, 1, 2 and 6 respectively. Since none is zero, 97 is prime.

For 91, the same candidates begin the test. Dividing by 7 gives exactly 13, so the test stops: 91 is composite. There is no need to keep testing larger candidates once a divisor proves compositeness.

Prime Number Formula and Divisibility Rule

There is no shortcut such as “all odd numbers are prime.” A practical exact rule for an integer n greater than 1 is:

n is prime ⇔ n mod p ≠ 0 for every prime p ≤ √n

Here, “mod” means the remainder after division. The square-root bound works because a pair of factors cannot both exceed √n: their product would be greater than n. Testing only prime divisors is sufficient because every composite divisor has its own prime factors.

Include the endpoint of the bound. For 49, the divisor 7 equals √49; skipping it would incorrectly label 49 prime. Useful early checks include divisibility by 2 for even numbers, by 3 when the digit sum is a multiple of 3, and by 5 for numbers ending in 0 or 5.

Prime Factorization Explained

Prime factorization breaks an integer greater than 1 into prime building blocks, keeping repeated factors. Apart from their order, these factors are unique.

For 84, divide successively: 84 ÷ 2 = 42, 42 ÷ 2 = 21, 21 ÷ 3 = 7, and 7 ÷ 7 = 1. The full factorization is 84 = 2 × 2 × 3 × 7 = 2² × 3 × 7. The exponent 2 records two copies of the factor 2.

This tool also acts as a prime factor checker. A prime input is already fully factored; for instance, 97 has the single prime factor 97. Standard prime factorization does not apply to 0 or 1.

Prime Numbers from 1 to 100

There are 25 prime numbers from 1 to 100. Notice that 1 is absent and 2 is the only even entry.

  • 2
  • 3
  • 5
  • 7
  • 11
  • 13
  • 17
  • 19
  • 23
  • 29
  • 31
  • 37
  • 41
  • 43
  • 47
  • 53
  • 59
  • 61
  • 67
  • 71
  • 73
  • 79
  • 83
  • 89
  • 97
Explore more prime numbers

46 primes from 1 to 200, generated using the Sieve of Eratosthenes.

  • 2
  • 3
  • 5
  • 7
  • 11
  • 13
  • 17
  • 19
  • 23
  • 29
  • 31
  • 37
  • 41
  • 43
  • 47
  • 53
  • 59
  • 61
  • 67
  • 71
  • 73
  • 79
  • 83
  • 89
  • 97
  • 101
  • 103
  • 107
  • 109
  • 113
  • 127
  • 131
  • 137
  • 139
  • 149
  • 151
  • 157
  • 163
  • 167
  • 173
  • 179
  • 181
  • 191
  • 193
  • 197
  • 199

Prime vs Composite Numbers

Comparing prime and composite integers
FeaturePrimeComposite
Greater than 1YesYes
Positive divisorsExactly twoMore than two
Nontrivial divisorNoneAt least one
Examples2, 3, 5, 7, 114, 6, 8, 9, 10
Can be even?Only 2Yes
Includes 0 or 1?NoNo

Prime Number Examples

Is 2 prime?

Check 2 using exact divisibility.

  1. 2 is greater than 1.
  2. No prime lies at or below √2 ≈ 1.41.
  3. The only positive factors are 1 and 2.

2 is prime, and it is the only even prime.

Is 17 prime?

Check 17 using exact divisibility.

  1. √17 ≈ 4.12, so test 2 and 3.
  2. 17 mod 2 = 1; 17 mod 3 = 2.
  3. Neither candidate is a divisor.

17 is prime.

Is 21 prime?

Check 21 using exact divisibility.

  1. √21 ≈ 4.58, so start with 2 and 3.
  2. 2 leaves a remainder; 21 ÷ 3 = 7.
  3. Stop when the divisor 3 is found.

21 is composite: 3 × 7.

Is 49 prime?

Check 49 using exact divisibility.

  1. √49 = 7, including the endpoint.
  2. 2, 3 and 5 leave remainders.
  3. 49 ÷ 7 = 7.

49 is composite: 7².

Is 97 prime?

Check 97 using exact divisibility.

  1. √97 ≈ 9.85; test 2, 3, 5 and 7.
  2. The remainders are 1, 1, 2 and 6.
  3. There is no prime divisor within the bound.

97 is prime.

Is 100 prime?

Check 100 using exact divisibility.

  1. 100 is even and greater than 2.
  2. 100 ÷ 2 = 50, proving it is composite.
  3. Factoring completely gives 2 × 2 × 5 × 5.

100 is composite: 2² × 5².

Is 101 prime?

Check 101 using exact divisibility.

  1. √101 ≈ 10.05; test 2, 3, 5 and 7.
  2. The remainders are 1, 2, 1 and 3.
  3. No candidate divides 101 exactly.

101 is prime.

Why Are Prime Numbers Important?

Primes organize the multiplicative structure of whole numbers. Factoring a numerator and denominator helps reveal common factors when simplifying fractions. Prime exponents also make it easier to find greatest common factors and least common multiples.

Try the Fraction Calculator to work with exact fractions. The Average Calculator and Roman Numeral Converter support other common number tasks.

Some public-key cryptography systems use the difficulty of factoring products of very large primes. The small educational range here is intended for learning and everyday arithmetic.

Frequently Asked Questions

What is a prime number checker?

It tests whether a whole number greater than 1 has a positive divisor other than 1 and itself. This checker also reports prime factors, nearby primes and the reasoning behind the answer.

How do I check if a number is prime?

First check that it is greater than 1. Then try dividing it by prime numbers no greater than its square root. One exact division proves it is composite; if none divides it evenly, it is prime.

Is 1 a prime number?

No. The number 1 has only one distinct positive factor. A prime needs exactly two, so 1 is neither prime nor composite.

Is 0 a prime number?

No. Primes and composites are integers greater than 1. Zero is outside both definitions and has no standard prime factorization.

Is 2 a prime number?

Yes. Its positive factors are exactly 1 and 2. Every larger even integer also has 2 as a nontrivial divisor.

Is 9 a prime number?

No. Since 9 = 3 × 3, it has the positive factors 1, 3 and 9 and is composite.

Is 17 a prime number?

Yes. Only 2 and 3 need testing because √17 is about 4.12. Neither divides 17 evenly.

Is 21 a prime number?

No. The equality 21 = 3 × 7 proves that 21 is composite.

Is 97 a prime number?

Yes. Its square root is about 9.85. The primes 2, 3, 5 and 7 all leave a nonzero remainder when dividing 97.

Is 101 a prime number?

Yes. The prime candidates through √101 are 2, 3, 5 and 7. None divides 101 evenly.

What is the smallest prime number?

The smallest prime is 2. The two smaller nonnegative integers, 0 and 1, are neither prime nor composite.

What is the only even prime number?

2 is the only even prime. Every even integer greater than 2 can be written as 2 times another integer greater than 1.

What is the difference between prime and composite numbers?

Both are integers greater than 1. A prime has exactly two positive factors, while a composite has more than two.

How do I find prime factors?

Divide by the smallest prime that works, keep dividing by it while possible, and then move to the next prime. Continue until the quotient is 1. For example, 84 = 2 × 2 × 3 × 7.

Can a prime number be negative?

Under the standard definition used in elementary number theory and this calculator, primes are positive integers greater than 1. Negative inputs are not supported.

How many prime numbers are there?

There are infinitely many primes. Any finite list misses a prime divisor of one more than the product of all the primes on that list.

What is the square-root method?

It is a divisibility test that stops at √n. If n = a × b and both factors exceeded √n, their product would exceed n, so a composite must have a smaller factor within that bound.

Is the Prime Number Calculator free?

Yes. You can check numbers, view steps and copy results without an account. Calculations run locally in your browser.

Method, Sources and Calculator Limits

The checker performs deterministic trial division by primes through the integer square root and stops at the first divisor. Factorization uses repeated exact integer-remainder checks. The explanation records the candidates actually tested; large checks show their count and a short preview.

All accepted inputs, from 0 to 1,000,000,000, receive exact classifications. Decimals, signs, grouping commas, scientific notation, hexadecimal and partial strings such as 97abc are rejected. A square root displayed to two decimal places is only explanatory; divisor testing uses an inclusive integer bound.

Previous and next primes are strictly smaller and larger than the input, even when the input is prime. There is no previous prime for 0, 1 or 2. Neighbor searches can extend to 1,000,001,000: for the maximum input, the next prime is 1,000,000,007. The list explorer is limited to 1,000 to keep it readable.

For additional explanations, see Math Is Fun: Prime Factorization. For alternative tools, see CalculatorSoup’s prime number calculator and Omni’s prime number calculator. Their supported ranges and features may differ.

Back to the calculator ↑

Exact checks, clear limits

Check whole numbers from 0 to 1,000,000,000. Trial division proves the classification, and 0 and 1 are handled separately.

Related tools