Prime Number Calculator
Check if a number is prime, factorize it, find the next prime, or list and count primes in a range.
Prime Number Calculator
Up to 10¹⁸ (18 digits). Commas are fine.
Methods and limits
- A prime is a whole number greater than 1 whose only divisors are 1 and itself. 0, 1 and negative numbers are neither prime nor composite.
- Single numbers up to 10¹⁸ are tested with a deterministic Miller–Rabin test (bases 2 to 41), which is exact — not probabilistic — for every number below 3.3 × 10²⁴. Factors are found by trial division and Pollard's rho, using exact integer (BigInt) arithmetic.
- Ranges use a segmented sieve of Eratosthenes, processed one million numbers at a time so the page stays responsive. Lists can cover 10 million numbers and counts 100 million; the range must end at or below 10¹².
Your data is processed locally in your browser and is not uploaded to OZVILO servers.
How to use the Prime Number Calculator
- 1Choose a mode: check a number, factorize it, find the next prime, list primes in a range, or count them.
- 2Enter the number or the range.
- 3Read the result with an explanation; large ranges run in the background with a progress bar and a Stop button.
- 4Download listed primes as TXT or CSV.
Examples
Check
- Input
- 97
- Result
- 97 is prime
Factorize
- Input
- 360
- Result
- 360 = 2³ × 3² × 5
Next prime
- Input
- after 100
- Result
- 101
Count
- Input
- primes up to 1,000,000
- Result
- 78,498 primes
Prime Number Calculator features
- Deterministic Miller–Rabin test up to 10¹⁸
- Fast factorization (trial division + Pollard's rho)
- Segmented sieve for ranges, without freezing the page
- TXT and CSV downloads
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two distinct positive divisors, 1 and itself. 1 has only one divisor, so it's neither prime nor composite. 2 is the only even prime.
How does the tool test large numbers?
It uses the Miller–Rabin test with a fixed set of bases (2 to 41), which is proven correct for every number below 3.3 × 10²⁴ — so for the inputs allowed here the answer is certain, not probabilistic. All arithmetic uses exact BigInt integers.
What limits apply to ranges?
Listing works for ranges up to 10 million numbers wide and counting up to 100 million, with the end at most 10¹². Work is split into chunks so the page stays responsive, and you can stop it at any time.
What is prime factorization?
Writing a whole number as a product of primes, such as 1,001 = 7 × 11 × 13. Every integer greater than 1 has exactly one prime factorization, apart from the order of the factors.
Related tools
- Available
Inverse Modulo Calculator
Find the modular multiplicative inverse with the extended Euclidean algorithm, for very large integers.
CalculatorsOpen tool - Available
Fibonacci Sequence Calculator
Generate Fibonacci numbers exactly — the nth term, the first N terms or a range — even with thousands of digits.
CalculatorsOpen tool - Available
Percentage Calculator
Work out percentages, percentage change and “what percent of” answers instantly.
CalculatorsOpen tool - Available
Matrix Transpose Calculator
Transpose a matrix of any shape — rows become columns — with index-by-index working.
CalculatorsOpen tool