Primes are the building blocks of the whole numbers: every integer above 1 is either prime or a unique product of primes. This calculator tests primality, factorizes numbers, and lists primes in a range — and it does so even for numbers far too large for a spreadsheet, using the same Miller-Rabin test that underpins modern cryptography.
What makes a number prime
A prime number has exactly two positive divisors: 1 and itself. That definition rules out 1 (which has only one divisor) and 0 (which is divisible by everything), so the smallest prime is 2 — and it is the only even prime, because every other even number is divisible by 2.
To check a number by hand you only need to test divisors up to its square root. If no whole number from 2 to √n divides n, then n is prime. That is why 97 needs only four trial divisions (2, 3, 5, 7) rather than ninety-five.
Factorization and the sieve
The fundamental theorem of arithmetic guarantees that every integer above 1 factors into primes in exactly one way. Prime factorization powers everything from reducing fractions to finding least common multiples. This tool uses trial division to peel off the smallest prime factor repeatedly until only 1 remains.
To find all the primes in a range, the fastest classical method is the sieve of Eratosthenes: list the numbers, then cross out the multiples of 2, then of 3, then of 5, and so on. Whatever survives is prime. A segmented sieve applies the same idea to just the window you ask for, which keeps it quick even across millions of numbers.
Big numbers and cryptography
Trial division is hopeless once numbers get large — testing a 60-digit number would take longer than the age of the universe. Instead, this calculator switches to the Miller-Rabin test, which uses modular exponentiation to decide primality in a fraction of a second. With a fixed set of witness bases the test is provably exact for every number below 3.3 × 10²⁴.
This matters because large primes are the foundation of public-key cryptography. RSA encryption multiplies two enormous primes together to form a public key; its security rests on the fact that factoring the product back into those primes is extraordinarily hard, even though testing a candidate for primality is easy. The asymmetry between fast primality testing and slow factoring is exactly what keeps encrypted traffic safe.