CalculatorSwitch
Calculator Switch
Math

Prime Number Checker

Last updated:

How to Use This Calculator

Step 1: Enter any positive whole number up to one trillion.

Step 2: Click Calculate.

Step 3: See whether the number is prime. If composite, the result includes the full prime factorization.

What Is a Prime Number?

A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. In other words, you cannot divide a prime number by any smaller whole number (except 1) without leaving a remainder.

The first ten prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. The number 2 is the only even prime — every other even number is divisible by 2.

Numbers that are not prime (and not 1) are called 'composite.' Every composite number can be written uniquely as a product of primes — this is the fundamental theorem of arithmetic, and it underpins number theory, cryptography, and modern computer security.

How to Check If a Number Is Prime

Trial division method:
1. If n < 2 → not prime
2. If n = 2 → prime
3. If n is even → not prime
4. Check odd divisors from 3 up to √n. If any divide n evenly, n is composite.
5. If no divisor is found → prime.

Why only up to √n? If n has a factor larger than √n, its paired factor must be smaller than √n — so you would have found it already.

Example: Is 29 prime? √29 ≈ 5.39. Check 3, 5. Neither divides 29 → prime.

Primes Under 100

RangePrimes
1–202, 3, 5, 7, 11, 13, 17, 19
21–4023, 29, 31, 37
41–6041, 43, 47, 53, 59
61–8061, 67, 71, 73, 79
81–10083, 89, 97
Total25 primes

Examples

Example 1: 17 → Prime. Tested 3 (17/3 ≈ 5.67, not whole). √17 ≈ 4.12, so no more checks needed.

Example 2: 91 → Not prime. 91 = 7 × 13. A common trick question — looks prime but isn't.

Example 3: 1 → Not prime. By definition, primes must be greater than 1.

Tips

1 is not prime — by modern definition, primes must be greater than 1.

2 is the only even prime. All other even numbers are composite.

91 is not prime — a classic trick (91 = 7 × 13).

RSA encryption relies on the difficulty of factoring large primes.

Frequently Asked Questions

Why is 1 not considered a prime number?
Historically, 1 was sometimes classified as prime, but mathematicians excluded it to make the fundamental theorem of arithmetic work cleanly. That theorem says every integer greater than 1 has a unique prime factorization. If 1 were prime, you could factor any number in infinitely many ways (for example, 6 equals 2 times 3, or 1 times 2 times 3, or 1 times 1 times 2 times 3, and so on). By excluding 1, every composite number has exactly one factorization into primes.
Are there infinitely many primes?
Yes. This was proved by Euclid around 300 BCE using an elegant argument: assume you have a finite list of all primes. Multiply them together and add 1. The resulting number is either a new prime not in your list, or it has a prime factor not in your list (since dividing by any prime in the list leaves a remainder of 1). Either way, your list is incomplete — so there must be infinitely many primes. This is still one of the most celebrated proofs in mathematics.
Why is 2 the only even prime?
Every even number is divisible by 2. For 2 itself, this is fine — its only divisors are 1 and 2 (itself). But every other even number has at least three divisors: 1, 2, and itself. For example, 4 is divisible by 1, 2, and 4. Since primes have exactly two divisors, no even number greater than 2 can be prime.
What is prime factorization and why does it matter?
Prime factorization is writing a composite number as a product of primes. For example, 60 equals 2 times 2 times 3 times 5, or 2 squared times 3 times 5. Every composite number has exactly one prime factorization (the fundamental theorem of arithmetic), which makes primes the building blocks of all integers. Prime factorization is used for finding GCF and LCM, reducing fractions, and in cryptographic algorithms like RSA.
How are prime numbers used in cryptography?
RSA encryption — the technology that protects online banking, secure websites, and encrypted messaging — relies on the fact that multiplying two large primes is easy, but factoring their product back into primes is extraordinarily slow. A 2048-bit RSA key uses two prime numbers each hundreds of digits long. Even the fastest supercomputers would take billions of years to factor such a product, which keeps encrypted data safe.
How fast is this prime checker for large numbers?
The calculator uses trial division up to the square root of the input, which runs quickly for numbers up to about a trillion (10^12). For numbers in that range, the answer returns instantly. For cryptographic-scale primes (hundreds of digits), professional software uses advanced algorithms like Miller-Rabin probabilistic testing, which this calculator does not implement. If you need to test truly enormous numbers, specialized number theory software is required.

Related Calculators

Was this useful?