How this prime number checker works
A prime number is a whole number greater than 1 that has exactly two positive divisors: 1 and itself. Numbers greater than 1 that are not prime are called composite — they can be broken down into a product of smaller factors. The numbers 0 and 1 are special cases: neither is prime, and 1 is not composite either.
To decide whether a number n is prime, this tool uses trial division up to the square root of n. If no integer from 2 up to √n divides n evenly, then n is prime. Testing only up to the square root is enough, because any factor larger than √n must pair with a factor smaller than √n that has already been checked. For very large inputs (above 1015) the tool switches to a fast Miller–Rabin probabilistic test to keep results instant.
Reference — the primes up to 50 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47.
Frequently asked questions
- What is a prime number?
- A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. For example, 7 is prime because nothing between 2 and 6 divides it evenly, while 8 is composite because it is divisible by 2 and 4.
- Is 1 a prime number?
- No. The number 1 is neither prime nor composite. A prime must have exactly two distinct positive divisors, but 1 has only one divisor (itself), so by definition it is excluded.
- Is 2 a prime number?
- Yes. 2 is the smallest prime and the only even prime, because its only divisors are 1 and 2. Every other even number is divisible by 2 and is therefore composite.
- What is prime factorization?
- Prime factorization is writing a number as a product of prime numbers. For example, 360 = 2 × 2 × 2 × 3 × 3 × 5, usually written with exponents as 2³ × 3² × 5. Every integer greater than 1 has a unique prime factorization.
- How do you check if a number is prime?
- Try dividing the number by every integer from 2 up to its square root. If none divide it evenly, the number is prime. You only need to test up to the square root because any larger factor would pair with a smaller one already checked.
- What is the largest known prime number?
- As of 2024 the largest known prime is 2136279841 − 1, a Mersenne prime with 41,024,320 digits found by the GIMPS project. There are infinitely many primes, so there is no single largest prime overall — only the largest one discovered so far.