Prime Number Checker
Instantly determine whether any positive integer is prime or composite. Useful for number theory homework, cryptography study, and mathematical curiosity.
About this calculator
A prime number is a positive integer greater than 1 that has no divisors other than 1 and itself. To check primality efficiently, test whether any integer from 2 up to √n divides n evenly. If any such divisor is found, the number is composite; if none is found, it is prime. The algorithm runs in O(√n) time. Formally: n is prime if and only if there is no integer i where 2 ≤ i ≤ √n and i divides n. Special cases: 0 and 1 are neither prime nor composite. For example, to check 29: √29 ≈ 5.39, so test 2, 3, 4, 5 — none divide 29, so it is prime.
How to use
Check whether 97 is prime. Compute √97 ≈ 9.85, so you only need to test divisors 2 through 9. Check: 97 ÷ 2 = 48.5 (no), 97 ÷ 3 ≈ 32.3 (no), 97 ÷ 4 = 24.25 (no), 97 ÷ 5 = 19.4 (no), 97 ÷ 6 ≈ 16.2 (no), 97 ÷ 7 ≈ 13.9 (no), 97 ÷ 8 = 12.1 (no), 97 ÷ 9 ≈ 10.8 (no). No divisor found — 97 is prime. Enter 97 in the Number field and the calculator confirms this instantly.
Frequently asked questions
Why is 1 not considered a prime number?
The number 1 is excluded from the primes by definition, and the reason is mathematical consistency. If 1 were prime, the Fundamental Theorem of Arithmetic — which states that every integer has a unique prime factorization — would break down, because you could always multiply by extra 1s (e.g., 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3). Excluding 1 preserves the uniqueness of prime factorizations, which is essential for number theory.
What is the largest known prime number?
As of 2024, the largest known prime is a Mersenne prime — a prime of the form 2ᵖ − 1. The current record holder has over 41 million digits and was discovered through the Great Internet Mersenne Prime Search (GIMPS), a distributed computing project. Finding large primes is important not just as a mathematical achievement but also in cryptography, where large primes underpin encryption algorithms like RSA. The simple trial division method used by this calculator is practical only for numbers up to a few million.
How are prime numbers used in real-world cryptography?
Prime numbers are the backbone of modern public-key cryptography. The RSA algorithm generates encryption keys by multiplying two very large prime numbers together — the product is easy to compute but extremely hard to factor back into its primes. This one-way difficulty is what keeps encrypted communications secure. Key sizes of 2048 or 4096 bits correspond to primes with hundreds of digits. Without prime numbers, secure online banking, private messaging, and digital signatures would not be possible.