Xerobit

Prime number checker: test, factorize and list primes

Enter a number to find out if it is prime, see its prime factorization, or generate a complete list of primes up to any limit. This prime number checker runs entirely in your browser so nothing is uploaded to a server.

Result

  • Is it prime?
    Yes
  • Number
    97
  • Divisible by
    Only 1 and itself

How to use the prime number checker

  1. Select the mode: Check if prime, Prime factorization, or List primes up to N.
  2. Enter the number you want to test, or the upper limit for generating a list.
  3. The result updates instantly as you type.
  4. For factorization, read the output as base and exponent pairs, such as 2^3 x 3^2.

How the primality test works

A prime number is a whole number greater than 1 that has no positive divisors other than 1 and itself. To check if a number n is prime, the algorithm tests divisibility by every integer from 2 up to the square root of n. If none divide evenly, the number is prime.

For example, to test 97: the square root of 97 is about 9.85, so we check divisors 2, 3, 4, 5, 6, 7, 8, and 9. None of these divide 97 without a remainder, confirming it is prime. Testing only up to the square root makes this prime number checker fast even for values in the millions.

What is a prime number?

A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A whole number greater than 1 that is not prime is called composite, because it can be split into smaller factors: 12 = 3 x 4, for example.

Two details trip people up. The number 2 is prime (and the only even prime), and the number 1 is neither prime nor composite. The number 0 is not prime either: it is divisible by every nonzero integer, so it has far more than two divisors.

Worked examples: is 91 prime?

The quick answer for 91 is no: 91 = 7 x 13. It looks prime because it is not divisible by 2, 3 or 5, which is why it is a classic trick question. Using the square-root rule, the square root of 91 is about 9.54, so you only need to test 2, 3, 5 and 7, and 7 divides it exactly.

These numbers are often guessed wrongly. Each result below comes from this checker's factorize mode:

NumberPrime factorizationAnswer
917 x 13Not prime
513 x 17Not prime
873 x 29Not prime
1197 x 17Not prime
14311 x 13Not prime
22113 x 17Not prime
10017 x 11 x 13Not prime
9797Prime (no divisor from 2 to 9)

Quick divisibility checks save time: a number is divisible by 3 when its digit sum is divisible by 3 (5 + 1 = 6, so 51 = 3 x 17), by 5 when it ends in 0 or 5, and by 11 when the alternating digit sum is a multiple of 11 (1 - 4 + 3 = 0, so 143 = 11 x 13).

Understanding prime factorization

Every integer greater than 1 can be expressed as a product of prime numbers. This is called prime factorization, and the Fundamental Theorem of Arithmetic guarantees that the factorization is unique regardless of the order of the factors.

To factorize 360, repeatedly divide by the smallest possible prime:

  • 360 / 2 = 180
  • 180 / 2 = 90
  • 90 / 2 = 45
  • 45 / 3 = 15
  • 15 / 3 = 5
  • 5 / 5 = 1

The result is three 2s, two 3s, and one 5, written as 2^3 x 3^2 x 5. When you use the factorize mode, the tool performs exactly this trial division process.

Reference table of small primes

Memorizing the first few primes helps with mental math and quick checks. Here are the prime numbers up to 100:

RangePrime numbers
1 to 202, 3, 5, 7, 11, 13, 17, 19
21 to 5023, 29, 31, 37, 41, 43, 47
51 to 10053, 59, 61, 67, 71, 73, 79, 83, 89, 97

Notice that 2 is the only even prime. Every other even number is divisible by 2, so no even number above 2 can be prime. After 5, all primes end in 1, 3, 7, or 9.

Prime numbers from 1 to 100 by decade

There are 25 prime numbers below 100. Grouped by decade, with the count in each group:

RangePrimesCount
1 to 92, 3, 5, 74
10 to 1911, 13, 17, 194
20 to 2923, 292
30 to 3931, 372
40 to 4941, 43, 473
50 to 5953, 592
60 to 6961, 672
70 to 7971, 73, 793
80 to 8983, 892
90 to 99971

The first 50 primes, which end at 229, are: 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, 211, 223, 227, 229. For longer lists, switch the tool to list mode, or open the prime numbers list tool.

Generating a prime numbers list

When you need a full list of primes up to a certain limit, the tool uses the Sieve of Eratosthenes. This ancient algorithm starts by assuming every number from 2 to N is prime, then iteratively marks the multiples of each discovered prime as composite.

For N = 30, the sieve crosses out multiples of 2 (4, 6, 8...), then multiples of 3 (9, 15, 21...), then 5 (25). What remains is the complete prime numbers list: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. The sieve is far more efficient than testing each number individually when generating large lists.

How many primes are there below 10, 100, 1,000 and more?

Primes thin out slowly as numbers grow. The counts below are exact values of the prime counting function, often written pi(N):

Up to NNumber of primesShare of numbers that are prime
10440.00%
1002525.00%
1,00016816.80%
10,0001,22912.29%
100,0009,5929.59%
1,000,00078,4987.85%
10,000,000664,5796.65%

The last row matches this tool's checking limit of 10,000,000: about one number in fifteen up to that limit is prime.

Common mistakes and edge cases

Several misconceptions trip people up when working with primes:

  • 1 is not prime. By definition, a prime must have exactly two distinct divisors. The number 1 has only one divisor, so it is excluded.
  • 0 and negative numbers are not prime. Primality applies only to integers greater than 1.
  • Large gaps exist. Primes become less frequent as numbers grow. Between 113 and 127 there are no primes at all, a gap of 14.
  • Not all odd numbers are prime. Numbers like 9, 15, 21, and 25 are odd but composite.

This prime number checker handles all these edge cases correctly, returning clear results whether you ask "is it prime" for 1, 0, or a large composite number.

Why primes matter

Prime numbers are the building blocks of arithmetic, but their importance extends well beyond the classroom. Modern cryptography relies on the difficulty of factoring the product of two very large primes. Protocols like RSA secure web traffic, banking transactions, and digital signatures by using keys derived from prime factorization.

In computer science, hash tables often use prime-sized arrays to distribute keys evenly and reduce collisions. Random number generators also incorporate primes to ensure long periods before sequences repeat. Whether you are studying number theory or debugging software, knowing how to quickly determine if a number is prime is a practical skill.

Worked examples

ExampleInputResult
Is 97 prime?Mode: check; Number: 97Is it prime?: Yes; Number: 97; Divisible by: Only 1 and itself
Factorize 360Mode: factorize; Number: 360Prime factorization: 2^3 x 3^2 x 5; Number: 360; Is it prime?: No
Primes up to 50Mode: list; Upper limit (N): 50Count: 15; Smallest prime: 2; Largest prime: 47; Upper limit (N): 50
Is 1 prime?Mode: check; Number: 1Is it prime?: No; Number: 1; Divisible by: Only 1

FAQ

Is 1 a prime number?

No. A prime number must have exactly two distinct positive divisors: 1 and itself. Since 1 only has one divisor, it is classified as neither prime nor composite.

What is the largest known prime?

As of late 2024, the largest known prime is the Mersenne prime 2^136,279,841 - 1, which has 41,024,320 decimal digits (found in October 2024). This tool limits inputs to 10,000,000 for checking and 100,000 for listing so results stay instant.

How do I read the prime factorization output?

The output uses caret notation for exponents. For example, 2^3 x 5 means 2 multiplied by itself 3 times (which is 8), then multiplied by 5, giving 40.

Can negative numbers be prime?

No. The standard definition of prime numbers applies only to positive integers greater than 1. Negative numbers, zero, and fractions are not considered prime.

Why does the list mode have a limit of 100,000?

Generating a prime numbers list requires memory proportional to the limit. Capping at 100,000 ensures the tool stays fast and responsive in any browser without freezing the page.

Is 2 the only even prime number?

Yes. Every other even number is divisible by 2, meaning they have at least three divisors (1, 2, and themselves), which disqualifies them from being prime.

Is 91 a prime number?

No. 91 = 7 x 13, so it has divisors other than 1 and itself. It is a common mistake because 91 is odd and not divisible by 3 or 5.

Is 0 a prime number?

No. Prime numbers are whole numbers greater than 1. Zero is divisible by every nonzero integer, so it does not have exactly two divisors.

What is a prime number in simple words?

A prime number is a whole number above 1 that can only be divided evenly by 1 and by itself. 7 is prime because nothing except 1 and 7 divides it; 8 is not, because 2 and 4 divide it.

How many prime numbers are there between 1 and 100?

There are 25: 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.

What are the first 10 prime numbers?

The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

Is 51 prime?

No. 51 = 3 x 17. The digits 5 and 1 add up to 6, which is divisible by 3, so 51 is divisible by 3.