Prime Checker
Test any integer to 10,000,000 for primality with trial division to √n, smallest factor, and witness division.
Calculator
Prime Check Inputs
Integer from 2 to 10,000,000
Verdict for 97
Results
Verdict
Prime
Exactly two divisors
None — prime
First exact divisor found
—
Partner of the smallest factor
9
No need to test past this
4
Candidates tested (2, 3, 6k±1)
97
Complete prime product
Trial division to √n is a complete proof at this scale: a witness equation for composites, a clean certificate for primes.
Visualizations
Trial-division workload
Search depth used
Smallest factor vs n
Formula
Divide by 2, 3, then 6k±1 candidates. The first exact hit witnesses compositeness; a clean run to √n certifies primality.
Alternative Form
Variables
| Symbol | Name | Unit | Description |
|---|---|---|---|
| n | Input integer | integer | 2 to 10,000,000 |
| √n | Trial bound | integer | Testing stops here (floored) |
| s | Smallest factor | integer | First exact divisor, if any |
| tests | Divisions run | count | Candidates actually tested |
Explanation
Divisor pairs straddle √n, so scanning to the root covers every pair. Skipping multiples of 2 and 3 keeps the scan lean without missing candidates.
Derivation
If n = a·b with a ≤ b, then a ≤ √n. Hence testing all d ≤ √n finds a factor iff one exists; 6k±1 covers every prime above 3.
Step-by-Step Calculation
Follow each step to understand how the result is calculated from your inputs.
Validate the input and compute the search bound.
Test the even tile first.
Test 3, then stride 6k±1 past all multiples of 2 and 3.
Stop at the first exact divisor — or at √n for primes.
Factorize fully to corroborate the verdict.
Issue the final verdict with its evidence.
Worked Examples
See how the calculator works with different scenarios.
Scenario
Default prime suspect.
Inputs
Calculation
√97 ≈ 9.8 Test 2,3,5,7 — all leave remainders
Result
97 is prime
Interpretation
Four clean divisions to the bound certify primality.
Understanding Your Result
Your Result: Prime or composite with witness evidence — see the verdict card.
Typical range: Tests run from 1 (even n) up to ~2,000 rows for near-cap primes.
What This Means
Prime means exactly two divisors; composite comes with the smallest factor and its cofactor as proof.
Why It Matters
Primality gates cryptography, hashing, and fraction work — a wrong verdict corrupts everything downstream.
Professional Interpretation
A witness equation is a complete compositeness proof; a clean run to √n is a complete primality proof at this scale.
Recommendations
- •Quote the witness for composites
- •Cite the √n bound for primes
- •Recheck evens above 2 instantly
- •Reject 1 as neither
- •Escalate huge candidates to probabilistic tests
Educational Content
Introduction
Primality asks whether an integer splits. Trial division answers exactly by testing every possible splitter up to the square root.
Concept Explanation
Divisors pair across √n, so the root bounds the search; the 6k±1 stride skips numbers already ruled out by 2 and 3.
Applications
Benefits
- •Exact verdict, not heuristic
- •Witness equation for composites
- •Certificate bound for primes
- •Visible trial tiles
- •Full factorization included
Limitations
- •Caps at 10,000,000
- •Linear scan slows near the cap
- •Single number per run
Best Practices
- •Test 2 first mentally
- •Bound every search at √n
- •Keep the witness equation
- •Treat 1 as neither
- •Stay within the cap
Common Misconceptions
Practical Tips
- •Test 2 first — evens above 2 fall instantly
- •Bound every manual check at √n
- •Read the witness as the compositeness proof
- •Use the 6k±1 stride (5, 7, 11, 13, …)
- •Treat a clean run to √n as a certificate
- •Reject 1 without testing
- •Stay at or below 10,000,000
Common Mistakes
Assumptions
This calculator makes the following assumptions to provide estimates:
Limitations
Be aware of these limitations when using this calculator:
Frequently Asked Questions
Answers to common questions about this calculator.
How do you check if a number is prime?
Why stop at the square root?
What is the smallest factor telling me?
Is 1 prime?
Is 2 prime?
Why is the cap 10,000,000?
What is a witness division?
Can an even number above 2 be prime?
How does this differ from the nth-prime tool?
Related Calculators
Explore more calculators related to this topic.
Related Guides
Deepen your understanding with these educational resources.
Glossary
Technical terms used in mortgage calculations explained in plain language.
- Prime number
- Integer above 1 with exactly two divisors.
- Composite number
- Integer above 1 that splits into smaller factors.
- Trial division
- Testing divisors ascending from 2.
- Witness
- An exact factorization proving compositeness.
- Smallest prime factor
- The least prime dividing n.
- Cofactor
- n divided by the smallest factor.
- 6k±1 stride
- Candidate pattern covering all primes above 3.
- Square-root bound
- Testing ceiling from divisor pairing.
Authoritative References
Trusted sources and standards referenced by this calculator.
Applicable Standards
Was This Calculator Helpful?
Page Information
2026-09-29
2.0.0
Free to use for educational and professional purposes.