What is a prime number?
A prime number is a whole number greater than 1 that has exactly two distinct divisors: 1 and itself. Examples include 2, 3, 5, 7, 11 and 13. Any whole number greater than 1 that is not prime is called composite, because it can be factored into smaller whole numbers. By convention, 0 and 1 are neither prime nor composite. This tool works for any whole number and is a universal mathematical calculator — it is not tied to any country or currency.
How to use this calculator
Type any whole number into the box and submit. The calculator instantly reports whether the number is prime or composite, counts its total divisors, and — if it is composite — shows the smallest factor greater than 1. This is handy for math homework, cryptography study, or just satisfying curiosity.
The formula explained
To test whether n is prime, we only need to look for a divisor d between 2 and the square root of n. If any such d divides n with no remainder, then n is composite and we stop. If we reach √n without finding a divisor, n is prime. We only check up to √n because if n = a × b, at least one of the factors must be ≤ √n — so a larger search is unnecessary. This makes the test fast even for large numbers.
$$\text{Prime} \iff \text{N} \geq 2 \;\text{and}\; \nexists\, d \in \left[2, \left\lfloor \sqrt{\text{N}} \right\rfloor\right] : \text{N} \bmod d = 0$$
Worked example
Take \(n = 97\). The square root of 97 is about 9.85, so we test divisors 3, 5, 7, 9 (after ruling out 2 since 97 is odd). None of them divide 97 evenly, so 97 has no factor up to its square root. Therefore 97 is prime with exactly 2 divisors.
$$\sqrt{97} \approx 9.85$$
FAQ
Is 1 a prime number? No. A prime must have exactly two distinct divisors, but 1 has only one divisor (itself), so it is neither prime nor composite.
Is 2 prime? Yes — 2 is the only even prime number. Every other even number is divisible by 2 and therefore composite.
Why check only up to the square root? Because divisors come in pairs that multiply to n. If both factors were larger than √n, their product would exceed n, which is impossible — so the smaller factor of any pair is always ≤ √n.