The Prime Number Checker tells you whether any number up to 1 billion is prime, shows its prime factorization if it isn’t, and can list all prime numbers within any range of up to 1,000 numbers.

Prime Number Checker

Check if a number is prime and find its prime factorization.

Result
โ€”

How to Use This Calculator

  1. Check a Number: Enter any integer โ‰ฅ 1 and click Calculate to see if it’s prime and its factorization.
  2. List Primes in Range: Switch to the range tab, enter a start and end (max 1,000 apart), and see all primes in that range.

What Is a Prime Number?

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first ten primes are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Two is the only even prime number โ€” all other even numbers are divisible by 2.

Prime numbers become increasingly rare as numbers get larger, but they never stop appearing โ€” there are infinitely many primes (proven by Euclid around 300 BCE). The largest known prime as of 2024 has over 41 million digits.

Prime Numbers in Real Life

Cryptography: RSA encryption โ€” used by every HTTPS website โ€” relies on the fact that multiplying two large primes is easy, but factoring the result back into those primes is computationally infeasible. Your online banking security depends on prime numbers.

Hashing: Prime numbers are used as table sizes in hash maps because they minimize collisions when taking modulo.

Music and nature: Cicadas emerge on prime-number year cycles (13 and 17 years) โ€” a prime cycle means they are out of phase with most predators’ population cycles.

Frequently Asked Questions

Is 1 a prime number?

No. By mathematical convention, 1 is neither prime nor composite. The definition of prime requires exactly two distinct divisors (1 and itself). 1 has only one divisor.

What is prime factorization?

Every composite number can be expressed as a unique product of prime numbers. For example, 360 = 2ยณ ร— 3ยฒ ร— 5. This is the Fundamental Theorem of Arithmetic.

How it works

Prime testing uses trial division: check divisibility from 2 up to โˆšn. If no divisor is found, the number is prime. This is O(โˆšn) โ€” fast enough for numbers up to 1 billion. Prime factorization divides out each prime factor repeatedly until the remaining value is 1.

Formula

isPrime(n): check n%d===0 for d from 2 to โˆšn. Factorize(n): divide by each prime factor d until n=1, recording powers.