Prime Number Checker
Check if a number is prime, perform prime factorization, and find adjacent primes
Range: -1000000 to 1000000
Enter an integer and click 'Check Prime' to start
What is a Prime Number?
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. 2 is the smallest prime and the only even prime.
Properties of Primes
There are infinitely many primes, with no largest prime. Primes have important applications in cryptography and computer science.
Prime Factorization
Any integer greater than 1 can be uniquely represented as a product of primes, known as the Fundamental Theorem of Arithmetic.
Special Numbers
0 and 1 are neither prime nor composite. Negative numbers can also be factorized, but usually only positive primes are considered.
Your Privacy is Protected
All calculations run locally in your browser. We do not store or transmit your data.
What is a Prime Number?
A prime number is a whole number greater than 1 that can only be divided evenly by 1 and itself. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. A number with more than two divisors (like 12, which divides by 1, 2, 3, 4, 6, 12) is called a composite number.
Primes are the “atoms” of arithmetic. The Fundamental Theorem of Arithmetic states that every whole number greater than 1 is either a prime itself or can be broken down into a unique product of primes. For example, 60 = 2 × 2 × 3 × 5, and no other set of primes multiplies to 60. This uniqueness is what makes primes so fundamental.
There is no simple formula that generates all primes, and they become less frequent as numbers get larger — but there are infinitely many of them, a fact proved by the ancient Greek mathematician Euclid around 300 BCE.
How to Check Primality and Factorize
To check if a number n is prime, test divisibility by every prime up to √n:
If no prime ≤ √n divides n evenly → n is prime
Example — is 97 prime?
√97 ≈ 9.8 → test 2, 3, 5, 7 → none divide 97 → 97 is prime
Example — factorize 60:
60 = 2 × 30 = 2 × 2 × 15 = 2 × 2 × 3 × 5 = 2² × 3 × 5
Key tip: You only need to test up to the square root because if n has a divisor larger than √n, it must also have one smaller than √n. This dramatically reduces the work for large numbers.
Common Use Cases
Cryptography — RSA encryption, used to secure HTTPS websites, online banking, and messaging apps, relies on the difficulty of factoring the product of two large primes. Without primes, modern internet security would not exist.
Computer science — Hash tables use prime-sized buckets to distribute keys evenly and avoid collisions. Prime numbers also appear in random number generators and error-correcting codes.
Mathematics education — Prime factorization is taught in middle school as the foundation for understanding fractions (simplifying via GCD/LCM), divisibility rules, and number theory.
Music and signal processing — Primes are used in Fourier analysis and in designing scales and tuning systems, where non-repeating ratios are desirable.
Frequently Asked Questions
What is a prime number?
A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Numbers with more than two divisors (like 6, which is divisible by 1, 2, 3, and 6) are called composite numbers. The number 1 is neither prime nor composite.
Why is 2 the only even prime number?
Every other even number is divisible by 2, which means it has at least three divisors (1, 2, and itself), making it composite. The number 2 is divisible only by 1 and 2, so it is prime. It is also the smallest prime number and the only prime that is even — all other primes are odd.
How do I find the prime factors of a number?
Divide the number by the smallest prime that divides it evenly, then repeat with the result until you reach 1. For example, to factor 60: 60 ÷ 2 = 30, 30 ÷ 2 = 15, 15 ÷ 3 = 5, 5 ÷ 5 = 1. So 60 = 2² × 3 × 5. Every composite number has a unique prime factorization (the Fundamental Theorem of Arithmetic).
How can I check if a large number is prime?
Test divisibility by all primes up to the square root of the number. If none divide evenly, the number is prime. For example, to test 97: √97 ≈ 9.8, so test primes 2, 3, 5, 7 — none divide 97, so it is prime. For very large numbers, algorithms like the Miller-Rabin test are used. Our calculator does this automatically.
Why are prime numbers important?
Primes are the building blocks of all whole numbers (every number is a unique product of primes), and they are the foundation of modern cryptography. RSA encryption, which secures online banking and messaging, relies on the fact that multiplying two large primes is easy, but factoring the result back into primes is extremely hard.