Prime Number Check

Enter an integer of up to 20,000 decimal digits to check whether it is prime. Calculations run directly in your browser using high-precision BigInt arithmetic. Numbers typed or pasted into the checker are never sent to the server. A number supplied through the page URL is part of the page request and should not be used for private values. Numbers below 264 are settled by a deterministic test; larger ones use Baillie–PSW, with live progress and a stop button.

Mersenne Input ...
Try for example:

What are prime numbers?

A prime number is a positive whole number greater than 1 that cannot be formed by multiplying two smaller natural numbers. In other words, a prime number has exactly two distinct positive divisors: 1 and itself.

Quick Rules:

  • 0 and 1 are not prime numbers.
  • 2 is the only even prime number.
  • All other prime numbers are odd (3, 5, 7, 11, 13, 17, 19, ...).

You can read more about what prime numbers are, how to check whether a number is prime, the different types of primes, the first million primes, and the history of prime numbers.

Sources & Further Reading

  1. Wikipedia: Prime number - General mathematical overview of primes, divisibility rules, and properties.
  2. Wikipedia: Baillie-PSW primality test - Technical details on the fixed base-2 Miller-Rabin check and Lucas probable-prime test used in this prime number checker.
  3. Wikipedia: Miller-Rabin primality test - Analysis of the modular exponentiation algorithms also used in this prime number checker.
  4. Wolfram MathWorld: Prime Number - Comprehensive reference on prime sequences, conjectures, and theorems.