Prime numbers: the atoms of arithmetic
A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number greater than 1 is composite — built by multiplying primes together — and the fundamental theorem of arithmetic guarantees that each composite has exactly one prime factorisation, one recipe, no matter how you break it down. Enter any whole number and this checker tells you whether it is prime, shows that factorisation when it is composite, and finds the nearest primes on either side, the neighbouring atoms in the number line.
The small cases deserve care, because they are where definitions are won and lost. The number 1 is not prime: it has only one divisor, not the required two, and if 1 counted as prime then factorisations would stop being unique, since extra 1s could be sprinkled anywhere. Zero is not prime either — everything divides zero, which is the opposite of having exactly two divisors. And 2 holds a unique distinction as the only even prime, because every other even number has 2 as a proper divisor. Of the numbers from 1 to 100, exactly 25 are prime, and they thin out as numbers grow — but, as Euclid proved over two thousand years ago, they never run out.
How the check works: trial division to the square root
To test a number, this page divides it by candidate primes up to its square root and stops at the first exact division. The square-root limit is not a shortcut that risks mistakes; it is a proof. Factors come in pairs straddling the square root, so if no divisor exists at or below it, no divisor exists anywhere. Skipping even candidates after 2 and stepping through the pattern around multiples of 6 keeps the test fast: numbers up to ten million resolve instantly, and the factorisation in the results is built by exactly the same divisions, collecting each prime and its exponent.
Reading a factorisation
A composite such as 91 shows its recipe as 7 × 13 — two primes, each to the first power. Powers collect repeats: 72 is 2^3 × 3^2, meaning 2 × 2 × 2 × 3 × 3, written plainly with a caret rather than superscript formatting so it can be copied anywhere. That recipe is immediately useful: it hands you the greatest common factor and lowest common multiple with any other factorised number (by comparing exponents), the count of divisors, and whether the number is a perfect square — it is, exactly when every exponent is even. For a prime, the factorisation is simply the number itself, which the page reports rather than dressing up.
Why primes matter far beyond the classroom
Modern encryption rests on an asymmetry in exactly this page's two operations: multiplying two large primes together is easy, while undoing the multiplication — factorising the result — is, for numbers hundreds of digits long, beyond any known practical method. Every secure purchase and private message leans on that gap. Primes also structure the everyday number system in quieter ways: gear teeth are often chosen as primes so wear patterns distribute evenly, cicadas emerge on prime-numbered year cycles that dodge predators' cycles, and the search for ever-larger primes — currently tens of millions of digits — remains one of mathematics' great public treasure hunts.
Worked example
97 is prime — no number up to its square root (about 9.8) divides it. The previous prime is 89 and the next is 101. By contrast 91 looks prime to many people but is 7 × 13, so it is composite.
How to use this calculator
- Enter a whole number — negatives are tested as their positive value.
- Read the verdict in the green panel: prime or not prime.
- For a composite, read its prime factorisation in the breakdown.
- Note the previous and next primes around your number.
- Follow the working panel to see why testing up to the square root is enough.
Prime gaps and twin primes
The distance to the neighbouring primes, which this page reports, opens a door onto active mathematics. Primes sometimes arrive in pairs two apart — 89 is followed after 97 by 101 with an unusually wide gap, while pairs such as 11 and 13 or 17 and 19 are called twins — and whether infinitely many twin primes exist is still unproven, though enormous progress was made in the last decade. Gaps between primes grow on average like the natural logarithm of the numbers involved, yet arbitrarily long prime deserts also exist: the factorials provide them, since the run starting just after a factorial is guaranteed composite. Your neighbouring-prime results are a tiny, honest window onto that landscape.