Prime Number Checker
Check whether a whole number has exactly two positive divisors. Enter a value from zero to one trillion and get a prime, composite, or neither result. For a composite number, the tool shows a factor pair that proves it can be divided further.
Loading the calculator. It runs in your browser, so JavaScript needs to be on.
How to use the Prime Number Checker
- Enter a whole number in Whole number. The accepted range is 0 through 1,000,000,000,000.
- Read Primality to see the classification. Decimals and negative numbers are rejected.
- For Composite, multiply the displayed factor pair to verify the original number. For Prime, the listed positive divisors are 1 and the number itself.
The formula
An integer n > 1 is prime when its only positive divisors are 1 and n. Trial division tests 2, then odd divisors d while d2 ≤ n. Finding any exact divisor proves n composite.
Worked example
Entering 97 returns Prime: none of the possible prime divisors up to its square root divides it exactly. Entering 91 returns Composite and the factor pair 7 x 13. Entering 1 returns Neither prime nor composite.
Why testing stops at the square root
If n = a times b and both factors exceeded the square root of n, their product would exceed n. Therefore a composite number must have at least one divisor no larger than its square root. For 91, the square root is between 9 and 10, and the factor 7 is enough to prove compositeness.
Zero, one and the only even prime
Zero and one are neither prime nor composite under the usual positive-integer definition. Two is prime because its only positive divisors are 1 and 2. Every larger even number is composite because it has 2 as an additional divisor. The checker handles these cases before testing odd candidates.
A factor pair is a proof, not a full factorization
For a composite result, the two factors multiply to your input, but either factor may itself be composite. Checking 100 returns 2 x 50 rather than the complete prime factorization 2 x 2 x 5 x 5. The one-trillion input cap keeps trial division responsive in a browser; it is not a cryptographic primality test.
Prime Number Checker questions
Is 1 a prime number?
No. A prime has exactly two positive divisors, while 1 has only one.
Is 2 prime even though it is even?
Yes. Two is the only even prime; every even integer greater than 2 is divisible by 2 and has more than two divisors.
What is the difference between prime and composite?
A prime integer greater than 1 has exactly two positive divisors. A composite integer greater than 1 has additional positive divisors.
Related calculators
- GCD & LCM CalculatorEnter whole numbers to find their greatest common divisor and least common multiple....
- Fraction CalculatorEnter two fractions to add, subtract, multiply or divide. Get the reduced fraction, mixed...
- Square Root CalculatorEnter a nonnegative number to find its principal square root, the opposite solution and...
- Exponent CalculatorEnter a base and exponent to calculate powers, including negative and fractional...