Prime Number Checker
Is n prime? Trial division up to √n; identifies smallest divisor and nearest primes if composite.
Result
✓ Prime
97
Has only divisors 1 and 97.
- Number97
- Prime?Yes
- Smallest factor— (only itself)
- Co-factor—
- Previous prime—
- Next prime—
Step-by-step
- Test divisibility by 2, 3, then 6k±1 up to √97 ≈ 9.8.
- No divisor found ⇒ 97 is prime.
How to use this calculator
- Enter integer.
- Read result + nearest primes.
About this calculator
A prime is a positive integer >1 with exactly two divisors: 1 and itself. The 6k±1 trial-division algorithm tests divisors up to √n: every prime >3 is of form 6k±1, so we skip 2/3 of integers. For n up to 10^15, this finishes in milliseconds. Beyond that, probabilistic tests (Miller-Rabin) are used. Famous primes: 2 (only even), 7 (Mersenne), 25-million-digit primes for crypto.
Frequently asked
No — by convention, primes are integers ≥2 with exactly two divisors. 1 has only itself.
Related calculators
Prime Factorization Calculator
n = p₁^a₁ × p₂^a₂ × … Trial division to find all prime factors with multiplicity.
GCD (Greatest Common Divisor) Calculator
Euclidean algorithm: gcd(a,b) = gcd(b, a mod b). Supports 2-6 integers.
LCM (Least Common Multiple) Calculator
lcm(a,b) = |a × b| / gcd(a,b). Smallest number that both a and b divide evenly.
Factorial Calculator (n!)
n! = 1 × 2 × … × n. Computes exactly up to 21! (number limit); approximate via Stirling for larger.
Scientific Notation Converter
Convert decimal ↔ scientific notation. Standard form a × 10^b with 1 ≤ |a| < 10.
Square Root Calculator (√n)
√n with integer-perfect-square check, simplified surd form, and decimal expansion.