Is It Prime?
Last reviewed: January 2026
A prime number checker determines whether a given integer is prime — divisible only by 1 and itself. It can also list all prime numbers within a range and show the prime factorization of composite numbers, supporting number theory and cryptography studies.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29... The number 2 is the only even prime — all other even numbers are divisible by 2 and therefore composite. Prime numbers are the building blocks of all integers — every whole number greater than 1 can be expressed as a unique product of primes (the Fundamental Theorem of Arithmetic).
To determine if a number n is prime, check whether any integer from 2 to √n divides it evenly. If none do, it's prime. Why only up to √n? Because if n = a × b, one of those factors must be ≤ √n. For example, to check if 97 is prime: √97 ≈ 9.85, so check divisibility by 2, 3, 5, 7. None divide 97 evenly, so 97 is prime. This shortcut dramatically reduces the work — instead of checking 96 potential factors, you check only 4.
Every composite number can be broken into a unique product of prime factors. For example: 60 = 2² × 3 × 5. 84 = 2² × 3 × 7. 360 = 2³ × 3² × 5. Prime factorization is essential for finding GCD (greatest common divisor), LCM (least common multiple), simplifying fractions, and solving number theory problems. See our Prime Factorization Calculator for step-by-step breakdowns.
Twin primes: Pairs of primes that differ by 2 (3,5), (11,13), (29,31). Are there infinitely many? Unproven — one of math's great open questions. Goldbach's Conjecture (1742): Every even number greater than 2 is the sum of two primes. Verified for numbers up to 4 × 10¹⁸ but never proven. Mersenne primes: Primes of the form 2ⁿ − 1. The largest known prime (as of 2024) is a Mersenne prime with over 41 million digits. Riemann Hypothesis: Concerns the distribution of primes and is arguably the most important unsolved problem in mathematics — a $1 million Clay Prize awaits the proof.
Cryptography: RSA encryption — the foundation of internet security — relies on the difficulty of factoring the product of two very large primes. A 2048-bit RSA key uses two ~300-digit primes. Multiplying them takes milliseconds; factoring the product back would take billions of years with current technology. Hash functions, digital signatures, and blockchain all depend on prime number properties. Nature: Cicadas emerge in prime-numbered year cycles (13 or 17 years), possibly to avoid synchronizing with predator cycles.
| Range | Primes | Count |
|---|---|---|
| 1–20 | 2, 3, 5, 7, 11, 13, 17, 19 | 8 |
| 21–40 | 23, 29, 31, 37 | 4 |
| 41–60 | 41, 43, 47, 53, 59 | 5 |
| 61–80 | 61, 67, 71, 73, 79 | 5 |
| 81–100 | 83, 89, 97 | 3 |
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The number 7 is prime because no integer between 2 and 6 divides it evenly. The number 12 is composite (not prime) because it is divisible by 2, 3, 4, and 6. The number 1 is neither prime nor composite by convention — excluding 1 from the primes ensures the Fundamental Theorem of Arithmetic works cleanly: every integer greater than 1 has a unique prime factorization. Without this exclusion, 12 could be factored as 2 × 2 × 3 or 1 × 2 × 2 × 3 or 1 × 1 × 2 × 2 × 3, destroying uniqueness.
The first 25 primes are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97. The number 2 is the only even prime — every other even number is divisible by 2 and therefore composite. Prime gaps (the distance between consecutive primes) are irregular: sometimes primes are just 2 apart (twin primes like 11,13 or 29,31), and sometimes gaps are much larger. Euclid proved around 300 BCE that there are infinitely many primes — no matter how far you go along the number line, you will always find another prime. His elegant proof by contradiction remains one of the most celebrated arguments in mathematics.
The simplest primality test is trial division: divide the candidate n by every integer from 2 up to √n. If none divide evenly, n is prime. The √n bound works because if n has a factor larger than √n, it must also have a corresponding factor smaller than √n (since their product equals n). For small numbers this is efficient — testing whether 997 is prime requires checking divisors only up to 31 (since √997 ≈ 31.6), and only prime divisors need to be checked (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31). For very large numbers, trial division becomes impractical: testing a 100-digit number would require checking up to a 50-digit divisor, which exceeds the computing capacity of any machine.
Modern cryptography uses probabilistic primality tests that can determine with near-certainty (but not absolute certainty) whether a number is prime. The Miller-Rabin test works by checking a mathematical property that all primes satisfy — if a number fails the test for any witness value, it is definitely composite; if it passes for many witnesses, it is almost certainly prime. Running Miller-Rabin with 40 random witnesses gives a false-positive probability of less than 2⁻⁸⁰, which is astronomically smaller than the probability of a hardware error affecting the computation. For practical purposes, numbers that pass 40 rounds of Miller-Rabin are treated as prime, and this approach generates the large primes (typically 1024-4096 bits) used in RSA encryption keys.
RSA encryption — the algorithm securing most internet commerce, banking, and government communications — relies on the difficulty of factoring the product of two large primes. Multiplying two 512-digit primes takes milliseconds, but factoring their 1024-digit product using the best known algorithms would take longer than the age of the universe on current hardware. This asymmetry between easy multiplication and hard factorization is the mathematical foundation of public-key cryptography. Your browser uses RSA (or similar algorithms) every time it connects to a secure website, generating and exchanging keys derived from large prime numbers. The security of your bank account, medical records, and personal communications depends on the computational difficulty of prime factorization — a problem that has resisted mathematical attack for centuries despite intense research effort.
The Goldbach Conjecture (1742) proposes that every even integer greater than 2 can be expressed as the sum of two primes. Verified computationally for all even numbers up to 4 × 10¹⁸ but never proven mathematically. The Twin Prime Conjecture holds that there are infinitely many pairs of primes separated by exactly 2 (such as 11 and 13, 17 and 19, 29 and 31). Yitang Zhang made groundbreaking progress in 2013 by proving that there are infinitely many prime pairs separated by some gap less than 70 million — a bound subsequently reduced to 246 by the Polymath project but still not down to 2. The Riemann Hypothesis, considered the most important unsolved problem in mathematics, concerns the distribution of primes and would, if proven, provide precise bounds on how primes are distributed among the integers. It has been open since 1859 and carries a $1 million Millennium Prize.
→ Double-check with manual calculation. Use the calculator to verify your work, or work the problem by hand first and check against the calculator's result.
→ Pay attention to units and precision. Make sure your inputs use consistent units. The calculator preserves decimal precision — round the final answer to the appropriate number of significant figures for your context.
→ Use for learning, not just answers. Review the formula and step-by-step breakdown to understand the underlying math — this builds intuition for future problems.
→ Try edge cases. Test with very large, very small, or zero values to build intuition about how the formula behaves across different inputs.
See also: Prime Factorization · GCD & LCM · Factorial Calculator · Modulo Calculator · Number Base Converter