Prime Number Checker
Whether a number is prime, and the nearest prime above and below it.
Results
What this tool does
A prime has exactly two divisors, itself and one, and there is no pattern that lets you recognise one at a glance — 561 looks no different from 563, yet the first is 3 × 11 × 17 and the second is prime. The only honest way to know is to try dividing, and the only thing that makes it quick is that you never have to test past the square root. Works up to a million million; the whole calculation happens in your browser.
Formula
tries dividing by every whole number up to the square root of the number
Variables
| Symbol | Meaning | Unit |
|---|---|---|
number | Number | — |
VD | Verdict | — |
IP | Prime (1 = yes) | — |
NP | Next prime above | — |
PP | Nearest prime below | — |
FD | Distinct prime factors | — |
Worked example
- Number7919
- Verdictprime
- Prime (1 = yes)1
- Next prime above7927
- Nearest prime below7907
- Distinct prime factors1
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.
Frequently asked questions
Why only test up to the square root?
Because divisors come in pairs that multiply to the number, and in every such pair one is at or below the square root and the other at or above it. If nothing at or below the square root divides the number, nothing above it can either. That single observation turns an impossible amount of work into a manageable one: checking a twelve-digit number means a million tests rather than a million million.