Prime Number Checker

Is n prime? Trial division up to √n; identifies smallest divisor and nearest primes if composite.

Inputs

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

  1. Test divisibility by 2, 3, then 6k±1 up to √97 ≈ 9.8.
  2. 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