Prime Number Checker

NUMBER THEORY TOOL

Prime Number Checker

Check whether a number is prime and discover prime numbers in any valid range.

Prime Number Checker

Test one whole number

Enter an integer from 0 to 9,007,199,254,740,991.

Prime Number Finder

Find primes within a range

Use whole numbers from 0 to 1,000,000. The range can span at most 100,000 numbers.

LEARN THE BASICS

What Is a Prime Number?

A prime number is a whole number greater than 1 that has exactly two positive factors: 1 and itself. For example, 2, 3, 5, 7, 11 and 13 are prime numbers.

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. The numbers 0 and 1 are neither prime nor composite.

2 The only even prime

Every other even whole number greater than 2 is composite.

1 Not a prime number

One has only one positive factor, not exactly two.

√n Efficient checking

To test a number, it is enough to check divisors up to its square root.

THE MATHEMATICS

Prime Number Formula and Method

There is no simple formula that directly lists every prime number. A standard way to test an integer \(n\) is to check whether any integer divisor exists between 2 and \(\sqrt{n}\).

Prime test

For \(n > 1\): if no integer \(d\) from \(2\) through \(\lfloor\sqrt{n}\rfloor\) divides \(n\) evenly, then \(n\) is prime.

If any such divisor exists, the number is composite.

Worked example: Is 29 a prime number?

  1. Calculate the square root: \(\sqrt{29} \approx 5.39\).
  2. Test the prime divisors up to 5: 2, 3 and 5.
  3. 29 is not divisible evenly by 2, 3 or 5.
  4. Therefore, 29 is a prime number.

Worked example: Is 21 a prime number?

  1. Calculate the square root: \(\sqrt{21} \approx 4.58\).
  2. Check 2, 3 and 4.
  3. 21 is divisible by 3 because \(21 \div 3 = 7\).
  4. Therefore, 21 is a composite number.
QUICK REFERENCE

Prime Numbers from 1 to 100

Use this table as a quick reference when studying prime numbers. The number 1 is included for comparison but is not prime.

Range Prime numbers
1–10 2, 3, 5, 7
11–20 11, 13, 17, 19
21–30 23, 29
31–40 31, 37
41–50 41, 43, 47
51–60 53, 59
61–70 61, 67
71–80 71, 73, 79
81–90 83, 89
91–100 97
WHERE THEY ARE USED

Practical Applications of Prime Numbers

  • Mathematics education: learning factors, divisibility and number patterns.
  • Computer science: prime numbers are used in some hashing methods and algorithm design.
  • Cryptography: large prime numbers play an important role in public-key systems such as RSA.
  • Problem solving: identifying prime factors can help simplify fractions and solve number theory problems.
COMMON QUESTIONS

Frequently Asked Questions

Is 1 a prime number?

No. A prime number must have exactly two distinct positive factors. The number 1 has only one positive factor.

Is 2 a prime number?

Yes. The number 2 has exactly two positive factors, 1 and 2. It is also the only even prime number.

How can I check whether a number is prime?

For an integer greater than 1, check whether any integer from 2 up to its square root divides it evenly. If none does, the number is prime.

What is the difference between prime and composite numbers?

A prime number greater than 1 has exactly two positive factors. A composite number has more than two positive factors. Zero and one are neither prime nor composite.

Can this tool find prime numbers in a range?

Yes. Enter a start and end number in the Prime Number Finder. The tool lists the prime numbers within the inclusive range, subject to its range-size limit.

Are negative numbers prime?

Under the standard definition used here, prime numbers are positive integers greater than 1. Negative integers are not classified as prime by this calculator.