Prime Number Checker, Factors, GCD & Sieve
Free prime number checker: is it prime, its prime factorization with a factor tree, every divisor, coprime check with GCD and LCM, an animated Sieve of Eratosthenes, the Ulam prime spiral, primes in a range, the nth prime and the prime counting function. Works for huge numbers.
Watch the sieve find every prime
Click any number to check it in “Is it prime?”.
Prime spiral
Primes between two numbers
The nth prime, and how many primes there are
How primes thin out
π(x) for powers of ten (known values)
| x | π(x) primes up to x | x ÷ ln x | One in every |
|---|
Prime numbers, explained
A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 … A number with more divisors is composite, and 1 is neither. Every whole number above 1 can be written as a product of primes in exactly one way (the fundamental theorem of arithmetic), which is why primes are called the building blocks of numbers.
What this page does
- Is it prime? Checks any number up to 3,000 digits, gives its prime factorization with a factor tree, every divisor, the number of divisors, their sum, Euler's totient φ(n), the nearest primes, its position in the list of primes and special types (twin, Sophie Germain, Mersenne, emirp, perfect, Carmichael …).
- Coprime, GCD & LCM finds the greatest common divisor and least common multiple of a list, says whether the numbers are coprime (relatively prime), draws their shared prime factors in a Venn diagram and shows Euclid's algorithm step by step.
- Sieve of Eratosthenes animates the 2,200-year-old method of crossing out multiples, and Prime spiral draws the Ulam and Sacks spirals where primes line up on diagonals.
- List & count lists the primes in a range (even near 10¹³), finds the nth prime and compares the prime count π(x) with x / ln x and li(x).
How the checking works
Small numbers are divided by every prime up to their square root: if none divides evenly, the number is prime (a divisor larger than √n always comes paired with one smaller). Big numbers use the Miller–Rabin test with the first 13 primes as bases, which is a proof for every number below 3.3 × 10²⁴. Above that, a number that passes 33 rounds is labelled a probable prime: no counterexample is known, but it is not a formal proof. Factoring uses trial division, then Pollard's rho method, which quickly finds factors up to about 15 digits; a number made of two huge primes (like the ones that protect RSA encryption) can't be split in a browser, and the page says so.
Questions people ask
- Is 1 a prime number?
- No. A prime needs exactly two different divisors, and 1 has only one. Leaving 1 out keeps every number's prime factorization unique.
- What does coprime mean?
- Two numbers are coprime (relatively prime) when their greatest common divisor is 1: they share no prime factor. 8 and 15 are coprime even though neither is prime.
- Why is 2 the only even prime?
- Every other even number is divisible by 2, so it has at least three divisors: 1, 2 and itself.
- How many primes are there?
- Infinitely many. Euclid's proof: multiply any list of primes together and add 1; the result is not divisible by any prime on the list, so some prime is missing from it.
- What is the largest known prime?
- A Mersenne prime, 2¹³⁶²⁷⁹⁸⁴¹ − 1, found in October 2024 by the GIMPS project. It has 41,024,320 digits.
- How do I find the GCD by prime factors?
- Write each number as primes, then multiply the primes they share, each to the smallest power it has in any of them. For the LCM, take every prime to its largest power.
Related: Calculator · Sum of Integers · CAS Calculator · Enigma Machine · More calculators
