Start with the basics
Numbers below 2 are not prime. The number 2 is the only even prime; every larger even number is composite.
Number theory, made clear
Is it prime or composite? Check a number, get its prime factorization, and follow the steps. Or explore a whole list of numbers at once.
29
Exactly two positive divisors. One and itself.
Understand the answer
You only need to test divisors up to the square root. If a larger factor exists, its smaller partner must be below that boundary.
The building blocks of numbers
Tap a number to explore its result.
The two-divisor rule
A prime number is a whole number greater than 1 with exactly two positive divisors: 1 and itself. For example, 29 is prime because only 1 and 29 divide it evenly.
A composite number has more than two positive divisors. For example, 91 = 7 × 13, so 91 is composite. 0 and 1 are neither prime nor composite.
Check it yourself
Numbers below 2 are not prime. The number 2 is the only even prime; every larger even number is composite.
If the digit sum is divisible by 3, the number is too. Numbers greater than 5 ending in 0 or 5 are composite. Passing these checks alone does not prove primality.
Test prime divisors up to √n. For 29, √29 ≈ 5.385: test 2, 3 and 5. None divides 29 evenly, so it is prime.
From curiosity to code
Use integer arithmetic to avoid rounding the square root. This trial division example handles small integers; very large numbers need more advanced primality tests.
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
divisor = 3
while divisor * divisor <= n:
if n % divisor == 0:
return False
divisor += 2
return True
print(is_prime(29)) # True
print(is_prime(91)) # FalseClear answers about primality, factors and the limits of this checker.
A prime number is a whole number greater than 1 with exactly two positive divisors: 1 and itself. The first primes are 2, 3, 5, 7, 11 and 13. A composite number, such as 4 or 91, has more than two positive divisors.
First check that the number is a whole number greater than 1. Then test divisibility by prime numbers up to its square root. If none divides it evenly, it is prime. For 29, only 2, 3 and 5 need testing, and none divides it evenly.
No. The number 1 has only one positive divisor, itself. A prime needs exactly two positive divisors. Both 0 and 1 are neither prime nor composite.
No. Prime numbers are whole numbers greater than 1. Decimal numbers such as 4.5 are neither prime nor composite, and this checker rejects decimal inputs instead of rounding them.
Every even number greater than 2 is composite. Numbers greater than 5 ending in 0 or 5 are composite. If the digit sum is divisible by 3, the number is divisible by 3. Passing these checks does not prove a number is prime; also test possible divisors up to its square root.
The trial division rule is to test whether n modulo d equals zero for any divisor d from 2 through the floor of the square root of n. If no divisor is found and n is greater than 1, n is prime. There is no simple last-digit rule that proves primality.
That number is above this checker’s supported limit of 1,000,000,000,000. The tool rejects it to avoid rounding or giving an unreliable verdict. Use an arbitrary-precision primality tool for numbers this large.
Batch mode checks up to 50 numbers separated by commas, spaces or new lines. Each number can be up to 1 trillion. The range finder lists all primes in an inclusive interval up to 1 million, with a maximum interval span of 10,000.
Single and batch checks use exact integer trial division and prime factorization within the supported limit. The range finder uses the sieve of Eratosthenes. Results are exact within these limits, rather than probabilistic primality estimates.
All primality checks run locally in your browser. Your entered numbers are not sent to a server by this calculator. No account is needed.