Prime Number Checker — Primality Test, Range & Factorization

Check if a number is prime, list primes in a range up to 100,000, or find the prime factorization of any number.

  • Primality test
  • Primes in range (up to 100k)
  • Prime factorization
  • Browser-only
97 is ✓ prime

About the Prime Number Checker

Three tools in one: check whether a single number is prime, list every prime in a range up to 100,000 with a count, or break a number into its prime factorization in exponent form. Students, puzzle solvers and programmers testing their own prime code use it. The check uses exact trial division, so tricky composites such as 561 are never mislabeled as prime.

How to use the Prime Number Checker

  1. Choose Check prime, Primes in range or Factorize.
  2. For a check or factorization, type an integer into Number.
  3. For a range, fill in From and To (max 100,000), with From smaller than To.
  4. Read the verdict, the count of primes found with the scrollable list, or the factorization with its flat list of factors.

Worked example: factorizing 2024

Trial division strips out the smallest prime repeatedly: 2024 / 2 = 1012, / 2 = 506, / 2 = 253. 253 is not divisible by 3, 5 or 7, but 253 / 11 = 23, and 23 is prime, so the search ends there.

Input (Factorize)
2024
Output
2024 = 2^3 × 11 × 23
Factors: [2, 2, 2, 11, 23]
ModeInputResult
Check prime79197919 is prime
Check prime561561 is not prime (3 × 11 × 17)
Primes in range9000 to 910011 primes, 9001 to 9091
Primes in range1 to 1000009,592 primes

How the test works

To check n, the tool rules out even numbers, then tries every odd divisor up to the square root of n. If none divides evenly, n is prime. Stopping at the square root is safe because any factor larger than it must pair with one smaller than it. For 7,919 that means trying odd numbers only up to 88.

The range mode uses a sieve of Eratosthenes, which crosses out multiples of each prime and keeps what remains, much faster than testing each number separately. Once you have the factorizations, the GCD and LCM calculator applies them to pairs or groups of numbers.

Edge cases

  • 1 is reported as not prime. Factorize needs a number of 2 or more.
  • Decimals are rounded down before testing, so 7.9 is checked as 7.
  • Results are exact up to 9,007,199,254,740,991. Larger inputs are rounded by JavaScript before testing, and primes near that limit can take a couple of seconds.
  • 561 is a Carmichael number, a composite that passes the quick Fermat test used by some programs. Trial division exposes it as 3 × 11 × 17.

Prime numbers: fundamentals

A prime number has exactly two distinct positive divisors: 1 and itself. Composite numbers have more than two divisors. 1 is neither prime nor composite by definition — this exclusion makes the Fundamental Theorem of Arithmetic work: every integer has a unique prime factorization.

The first 25 primes: 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. They become less frequent as numbers grow but never stop.

Prime factorization and its uses

Every composite number breaks into a unique product of primes. 360 = 2^3 times 3^2 times 5. GCD and LCM can be computed from factorizations: GCD takes the minimum exponent for each prime; LCM takes the maximum.

RSA cryptography relies on the difficulty of factoring large semiprime numbers. While finding primes is fast, factoring their product back into two primes is computationally hard — this asymmetry is the foundation of public-key cryptography.

Prime Number Checker: frequently asked questions

What is a prime number?
A prime number is a natural number greater than 1 with no positive divisors other than 1 and itself. Examples: 2, 3, 5, 7, 11. The number 1 is not prime. 2 is the only even prime.
How is primality tested?
Trial division checks if the number is divisible by any integer from 2 up to its square root. If no divisor is found, the number is prime. This checker uses trial division, which stays fast for numbers up to about a trillion.
What is prime factorization?
Prime factorization expresses a number as a product of primes. Example: 360 = 2^3 times 3^2 times 5. Every integer greater than 1 has a unique prime factorization (Fundamental Theorem of Arithmetic).
Are there infinitely many prime numbers?
Yes. Euclid proved this around 300 BC: multiply all known primes and add 1 — the result is either prime or has a prime factor not in the original list, so no finite list contains all primes.