🧮 MathbeginnerOffline

Prime Numbers

Check if a number is prime, or list all primes up to N.

Inputs
Enter your values below.
Result
Your answer appears here.

Enter values and press Calculate — the result appears here.

How it works
The formula behind this calculator.

Trial division up to √n; or Sieve of Eratosthenes for ranges

n
The integer to test

A prime has exactly two divisors: 1 and itself. To test primality, try dividing by every integer from 2 up to √n. None divide evenly → prime.

Example: 17 is prime: no d from 2 to √17 ≈ 4.12 divides it

Ref: Fundamental Theorem of Arithmetic

Tips
  • 💡 1 is not a prime number. 2 is the only even prime.
  • 💡 Numbers ending in 0, 2, 4, 6, or 8 (except 2 itself) are never prime.

FAQ

What is the largest known prime?

As of 2024, the largest known prime has over 24 million digits. It's a Mersenne prime: 2⁸²⁵⁸⁹⁹³³ − 1.

Related calculators