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
- Choose Check prime, Primes in range or Factorize.
- For a check or factorization, type an integer into Number.
- For a range, fill in From and To (max 100,000), with From smaller than To.
- 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.
20242024 = 2^3 × 11 × 23
Factors: [2, 2, 2, 11, 23]| Mode | Input | Result |
|---|---|---|
| Check prime | 7919 | 7919 is prime |
| Check prime | 561 | 561 is not prime (3 × 11 × 17) |
| Primes in range | 9000 to 9100 | 11 primes, 9001 to 9091 |
| Primes in range | 1 to 100000 | 9,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.