Interactive Math Lab

Prime Numbers

The fundamental building blocks of all mathematics

💡 What Are Prime Numbers?

🔵 Prime Numbers

A number greater than 1 that has exactly two factors: 1 and itself. It cannot be divided evenly by any other whole number.

2 3 5 7 11 13

🟠 Composite Numbers

A number greater than 1 that has more than two factors. It can be broken down into a product of prime numbers.

4 6 8 9 12 15

⭐ The Special Case: 1

The number 1 is neither prime nor composite. It has only one factor (itself). By mathematical convention, 1 is excluded from both categories — and for good reason: including it would break the Fundamental Theorem of Arithmetic.

🏗️ The Fundamental Theorem of Arithmetic

Every integer greater than 1 is either prime itself, or can be written as a unique product of primes — regardless of the order. Think of primes as the atoms of mathematics: all other numbers are molecules built from them.

12 = 2² × 3 30 = 2 × 3 × 5 100 = 2² × 5² 360 = 2³ × 3² × 5
🌍 Why Do Primes Matter?
🔐

Cryptography

RSA encryption — used in every HTTPS website and secure transaction — relies on the fact that multiplying two large primes is easy, but factoring the result is computationally infeasible.

🔢

Number Theory

Primes are the foundation of advanced mathematics including modular arithmetic, Diophantine equations, and analytic number theory.

📡

Signal Processing

Fast Fourier Transforms and hash functions used in data compression and networking exploit properties of prime numbers.

🐛

Nature

Cicadas emerge every 13 or 17 years (both prime) to avoid predators with 2–6 year cycles. Primes appear throughout biology.

📜 Historical Milestones
~300 BCE

Euclid's Proof

Euclid proved there are infinitely many primes — one of the oldest mathematical proofs still in use today.

~240 BCE

Sieve of Eratosthenes

A simple algorithm to find all primes up to a given limit. Still taught and used in computer science today.

1859

Riemann Hypothesis

Bernhard Riemann conjectured a deep connection between primes and complex analysis. It remains one of math's greatest unsolved problems.

1977

RSA Encryption Born

Rivest, Shamir & Adleman developed RSA — the first practical public-key cryptosystem — built entirely on prime number theory.

2024

Largest Known Prime

The largest known prime has over 41 million digits — a Mersenne prime (2ⁿ − 1) — discovered by the GIMPS distributed computing project.

🔍 Sieve of Eratosthenes — Interactive Simulation

The Sieve is a 2,200-year-old algorithm. Start with all numbers 2–100. Cross out multiples of each prime — what remains are all primes! Step through it one prime at a time.

Confirmed Prime
Being Eliminated
Composite (eliminated)
1 (neither)
600ms
Click Next Step to begin the Sieve of Eratosthenes. We'll eliminate multiples step by step.
🧮 Prime Number Tester

Enter any number and watch the divisibility tests run in real time. See exactly why a number is prime or composite.

📏 Divisibility Rules — Quick Reference
÷ 2
Last digit is 0, 2, 4, 6, or 8 (even)
÷ 3
Sum of digits divisible by 3
÷ 5
Last digit is 0 or 5
÷ 7
Double last digit, subtract from rest. If result ÷ 7 → yes
÷ 11
Alternating digit sum divisible by 11
√n Rule
Only need to test divisors up to √n to prove primality
🌳 Prime Factorization — Factor Tree

Enter a composite number and see its factor tree built automatically. Every branch ends at a prime — those are the atoms that make up your number.

Enter a number and click Build Tree →

🎯 Prime or Composite? — Challenge Mode
0
Correct
0
Wrong
0
Streak 🔥
?
Press Start to begin the challenge!
🔐 Primes in Cryptography — RSA Concept Demo

RSA encryption — the backbone of internet security — works because multiplying two primes is trivial, but factoring the result is extremely hard. Select two primes below to see the concept in action.

Select Prime p

Selected:

Select Prime q

Selected:
🔬 The Factoring Challenge

Can you factor these numbers into their two prime components? This is exactly what makes RSA hard at scale.