Prime number calculator
Check whether a number is prime, see its full prime factorization and every divisor, with the next and previous primes and the division steps shown.
Result
Number checked
-
Enter a number
- Prime factorization
- -
- All divisors
- -
- Next prime
- -
- Previous prime
- -
Factorization, step by step
Each step divides by the smallest prime that still divides evenly.
| Step | Divide by | Result |
|---|
How it works
A prime number is a natural number greater than 1 whose only positive divisors are 1 and itself, and every integer greater than 1 has a unique prime factorization by the Fundamental Theorem of Arithmetic.
- Enter a number
Any whole number of 2 or more.
- Read the check
Prime or composite, with the reasoning behind it.
- See the breakdown
Full factorization, every divisor, and the nearest primes.
Checking primality by trial division
To test if a number is prime, divide it by every integer from 2 up to its square root. If none divide evenly, the number is prime. For 97, the square root is about 9.8, so only 2 through 9 need testing; none divide 97 evenly, so 97 is prime. This calculator uses the same trial-division method, skipping even numbers and multiples of 3 after checking them once, which keeps it fast even for 12-digit numbers.
n is prime if no integer from 2 to √n divides it evenly
Prime factorization
Every integer greater than 1 can be written as a unique product of primes. For 84: divide by 2 to get 42, divide by 2 again to get 21, divide by 3 to get 7, which is prime. So 84 = 2² × 3 × 7. This is the Fundamental Theorem of Arithmetic, and the step-by-step table above shows the same working for whatever number you enter.
Divisors versus prime factors
Prime factors are the primes that multiply together to build the number; for 12 they are 2, 2 and 3. All divisors include every integer that divides the number evenly: for 12, that is 1, 2, 3, 4, 6 and 12, six divisors in total. A prime number always has exactly two divisors, 1 and itself, which is the fastest way to spot one.
The primes up to 100
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, twenty-five in total. Two is the only even prime; every other even number is divisible by 2 and therefore composite.
Frequently asked questions
How do you check if a number is prime?
Test divisibility by all integers from 2 up to the square root of the number. If none divide it evenly, it is prime. For 97, the square root is about 9.8, so only divisors 2 to 9 need testing. None divide 97 evenly, so 97 is prime. The calculator implements this trial division algorithm and shows a prime or not-prime result.
What is prime factorization and how is it found?
Prime factorization expresses a number as a product of primes. For 84, divide by 2 to get 42, divide by 2 again to get 21, divide by 3 to get 7, which is prime. So 84 = 2² × 3 × 7. The Fundamental Theorem of Arithmetic guarantees this factorization is unique for every integer greater than 1.
Is 1 a prime number?
No. By definition, a prime must be greater than 1. The number 1 has only one divisor, itself, while primes need exactly two, 1 and the number itself. Excluding 1 from primes preserves the uniqueness in the Fundamental Theorem of Arithmetic; if 1 were prime, factorizations would not be unique.
How many primes are there up to 100?
There are 25 primes up to 100: 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. Two is the only even prime; every other even number is divisible by 2 and therefore composite.
What is the difference between prime factors and all divisors?
Prime factors are the prime numbers that multiply together to form the number; for 12, they are 2, 2 and 3, or 2² × 3. All divisors include every integer that divides the number: for 12, all divisors are 1, 2, 3, 4, 6 and 12, six total. The calculator lists all divisors and the full factorization together.