Number Theory Calculator

Explore prime numbers, factorization, greatest common divisors, modular arithmetic, and more. All calculations are performed locally in your browser — your input is never uploaded.
Mode:
Enter a number and click "Check"
Tip: Uses deterministic Miller-Rabin for numbers up to 264. Click "Next Prime" or "Prev Prime" to find nearby primes.
Primes and congruences

A prime has exactly two divisors, 1 and itself; every integer greater than 1 factors into primes in exactly one way (the fundamental theorem of arithmetic). Congruence a ≡ b (mod n) means n divides a−b — arithmetic on a clock face, where 10 + 5 ≡ 3 (mod 12), and the foundation of GCD, LCM and modular exponentiation.

Multiplying two big primes is instant, but recovering them from the product is computationally brutal — that one-way asymmetry is what RSA encryption is built on, and why φ(n) of a 2048-bit modulus is not public.