๐Ÿ”‘ Prime Number Checker

Result

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. Numbers with more than two factors are called composite numbers.

Examples of Prime Numbers

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97...

A number n is prime if it has exactly two factors: 1 and n itself.
2 is the only even prime number.

How to Check if a Number is Prime

  1. If n โ‰ค 1, it is not prime.
  2. If n = 2 or n = 3, it is prime.
  3. Check divisibility by all numbers from 2 to โˆšn.
  4. If divisible by any, it is composite. Otherwise, it is prime.

Primes up to 100

There are 25 prime numbers between 1 and 100. Memorising the smaller ones is genuinely useful for mental math:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

Sieve of Eratosthenes

An ancient algorithm (c. 240 BC) to find all primes up to n efficiently:

  1. List all integers 2 to n
  2. Start with p=2. Mark all multiples of 2 (4, 6, 8...) as composite
  3. Move to next unmarked number (3). Mark all multiples of 3 as composite
  4. Continue until p > โˆšn
  5. Remaining unmarked numbers are all prime

Prime Number Theorems

FactDetails
There are infinitely many primesProved by Euclid c. 300 BC
2 is the only even primeAll other even numbers divisible by 2
Every integer >1 has a unique prime factorizationFundamental Theorem of Arithmetic
Largest known prime (2024)2ยนยณโถ,ยฒโทโน,โธโดยนโˆ’1 (Mersenne prime, ~41 million digits)

Real-World Applications

  • Cryptography: RSA encryption (used in HTTPS/banking) relies on the difficulty of factoring large numbers into primes. A typical RSA key uses two 150-digit primes.
  • Hash functions: Prime numbers are used in hash tables and checksums for optimal distribution
  • Cicadas: Some cicada species emerge every 13 or 17 years (prime numbers) โ€” an evolutionary strategy to avoid predator cycles
  • Number theory: Foundation of modular arithmetic, congruences, and Diophantine equations

Frequently Asked Questions

Is 1 a prime number? โ–ผ
No. By definition, prime numbers must have exactly two distinct factors: 1 and themselves. The number 1 has only one factor (itself), so it is neither prime nor composite.
Is 2 a prime number? โ–ผ
Yes! 2 is the only even prime number. It has exactly two factors: 1 and 2.
What are the first 10 prime numbers? โ–ผ
The first 10 prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.