Prime Number Calculator
Test cases replayed : 6 of 6 match · Methodology · No outside source listed
Enter a whole number to find out if it is prime, composite, or neither.
Result
Result
Trial divisors tested up to (√n rounded down)
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Whole number (0 to 1,000,000,000,000): enter a number from 0 to 1,000,000,000,000.
- Read the result: Result; the panel also shows Trial divisors tested up to (√n rounded down).
How this calculator works
A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. A whole number greater than 1 that is not prime is composite; 0 and 1 are neither.
The calculator uses trial division: if n has a divisor other than 1 and n, one of them is at most √n, so it tests 2 and then every odd number up to √n. If none divides n, n is prime.
Worked example
| Whole number (0 to 1,000,000,000,000) | 97 |
|---|
| Result | Prime |
|---|---|
| Trial divisors tested up to (√n rounded down) | 9 |
Frequently asked questions
Is 1 a prime number?
No. A prime needs exactly two positive divisors, and 1 has only one.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it is composite.
Is 91 prime?
No. 91 = 7 × 13.