Prime Number Checker
Check whether a number up to 10^18 is prime, with its smallest factor and the next and previous primes.
Your inputs
Results
Is it prime?
Yes — prime
- Next prime
- 1000033
- Previous prime
- 999983
✓Exact calculation — rounded only for display
Notes for this result
- Uses a deterministic Miller–Rabin test that is exact for every number up to 3.3 × 10^24.
What this calculator does
A prime has exactly two divisors: 1 and itself. Checking large numbers requires a fast, reliable primality test.
Formula and method
Deterministic Miller–Rabin test with the first 12 prime bases, exact for all n < 3.3 × 10^24.
Worked example
Calculated by this tool with its default inputs:
Inputs
- Whole number: 1000003
Results
- Is it prime?: Yes — prime
- Next prime: 1000033
- Previous prime: 999983
How to read the results
Composite numbers show their smallest prime factor.
Assumptions and limitations
- 0 and 1 are not prime.
Questions
Is 561 prime?
No. It is a Carmichael number (3 × 11 × 17) that fools some simpler tests.
Methodology and verification
- Result type
- Exact mathematical calculation (rounded only for display)
- Formula version
- 1.0
- Automated verification
- 6 reference and validation test cases, checked against independently computed values. The site cannot be built if any of them fail.
- Editorial review
- Awaiting human editorial review. The explanation was drafted with AI assistance; the formula and examples are verified by the automated tests above.
Privacy
Everything you enter is calculated in this browser and is not sent to Numerith or anyone else. Inputs are added to a share link only if you choose to include them. Privacy policy