LEVEL 01 · BEGINNER

Every number has
a beginning.

Start with one simple question: can this number be broken into smaller factors? That's your doorway into the world of primes.

01 / The atoms of arithmetic

Some numbers can't
be broken down.

A divisor is a positive integer that divides a number without leaving a remainder. Count those divisors, and you can tell what kind of number you're looking at.

07

Prime

A positive integer greater than 1 with exactly two positive divisors: 1 and itself. The divisors of 7 are just 1 and 7.

12

Composite

An integer greater than 1 with more than two positive divisors. The divisors of 12 are 1, 2, 3, 4, 6, and 12.

01

The unit

1 has exactly one positive divisor: itself. It is neither prime nor composite. Zero and negative integers are not primes in this setting either.

Why “atoms”? Every integer greater than 1 has a unique prime factorization, apart from the order of the factors. For example, 84 = 2 × 2 × 3 × 7. This is the Fundamental Theorem of Arithmetic.

A reason to care / Beginner

Why do we need primes
in the first place?

Primes are not a rule someone invented to make arithmetic harder. They emerge when we ask which whole numbers can be assembled by multiplication. Just as letters let us organize words, primes let us organize multiplication—but unlike words, the prime ingredients of a positive integer are unique.

Understand rather than memorize

Knowing 60 = 2² × 3 × 5 immediately tells you that 60 is divisible by 12, but not by 7 or 8. You can simplify fractions, compare rhythms, count divisors, and find common factors using the same small collection of building blocks.

For example, 42/60 = (2 × 3 × 7)/(2² × 3 × 5) = 7/10. Canceling matching prime factors explains the shortcut.

Build reliable mathematical worlds

Arithmetic modulo a prime lets every nonzero number have a multiplicative inverse. That makes division possible in a finite system, which helps build error-correcting codes and some cryptographic systems.

Not every prime application uses giant primes, and not every cryptographic algorithm relies on primes. Follow the actual applications, not the myths.

Deeper note: why not call 1 prime?

If 1 were a prime, we could write 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3, and so on. To state unique factorization cleanly, multiplication by a unit is separated from multiplication by a prime. The positive integers have one unit, 1; the ordinary integers have units 1 and −1.

Visual lesson / Beginner → Intermediate

Pull a number apart.

A composite number splits into smaller factors. Keep splitting until the leaves are prime. Different first splits give the same collection of prime leaves: 84 = 2 × 42 = 6 × 14 = 4 × 21.

Count divisors without listing them

If n = p₁a₁…pₖaₖ, then τ(n) = (a₁ + 1)…(aₖ + 1). Every divisor chooses how many copies of each prime to include.

For 84 = 2² × 3 × 7, choose 0, 1, or 2 copies of 2, and 0 or 1 of each other prime: 3 × 2 × 2 = 12 divisors.

Count the coprime neighbors

Euler's totient φ(n) counts integers from 1 through n that share no factor greater than 1 with n. The formula is φ(n) = n ∏p|n(1 − 1/p).

For 84, remove multiples of 2, 3, and 7, accounting for overlap: φ(84) = 84 × 1/2 × 2/3 × 6/7 = 24. For prime p, φ(p) = p − 1.

Checkpoint: must two coprime numbers both be prime?

No. The composites 8 and 9 share no prime factor, so gcd(8, 9) = 1. “Prime” describes one number; “coprime” describes a relationship between numbers.

Visual lesson / Everyday arithmetic

Find the common rhythm.

The greatest common divisor (GCD) finds the largest shared building block. The least common multiple (LCM) finds the first shared repeat. If two lights flash every 12 and 18 seconds, they next flash together after 36 seconds: lcm(12, 18).

    Each bar shows the remainder as a fraction of the current divisor. The equations are exact; the bars are visual guides.

    Why does Euclid's algorithm work?

    If a = qb + r, every common divisor of a and b divides r = a − qb. Conversely, a divisor of b and r divides a = qb + r. So gcd(a, b) = gcd(b, r). The remainders shrink until one is zero. The last nonzero value is the GCD, and lcm(a, b) = ab/gcd(a, b) for positive a and b.

    Proof workshop / Learn how mathematicians know

    From a pattern
    to a reason.

    Proof 1: why testing up to √n is enough

    Suppose n is composite, so n = ab with 1 < a ≤ b. If both a and b were greater than √n, their product would exceed n. Therefore a ≤ √n, and a has a prime divisor no larger than itself. To prove 97 prime, it is enough to test 2, 3, 5, and 7—not every number below 97.

    Proof 2: why prime factorization is unique

    The key is Euclid's lemma: if a prime p divides ab, it divides a or b. If p does not divide a, then gcd(p, a) = 1, so integers x and y exist with xp + ya = 1. Multiply by b to see that p divides b. Apply the lemma to two proposed prime factorizations, match one prime at a time, and cancel. Eventually all prime factors match, including their multiplicities.

    Proof 3: why there are infinitely many primes

    Suppose p₁, …, pₖ were all the primes. Let N = p₁…pₖ + 1. None of those primes divides N because each leaves remainder 1. But N > 1 has a prime divisor, contradicting the list. N itself does not have to be prime: 2 × 3 × 5 × 7 × 11 × 13 + 1 = 30,031 = 59 × 509.

    Proof 4: why primes above 3 look like 6k ± 1

    Every integer has remainder 0, 1, 2, 3, 4, or 5 modulo 6. Remainders 0, 2, and 4 give even numbers; remainder 3 gives a multiple of 3. A prime above 3 must therefore have remainder 1 or 5. The converse is false: 25 and 35 have those remainders but are composite.

    A useful counterexample: Euler's prime-producing polynomial

    n² + n + 41 is prime for n = 0 through 39. At n = 40 it equals 41² = 1,681. Forty successful tests do not establish an infinite pattern. More generally, a nonconstant integer polynomial cannot take only positive prime values for all positive integers.

    Continue with MIT's Theory of Numbers lecture notes. All explanations here are written for this site.

    02 / A very human story

    Ancient questions.
    Extraordinary discoveries.

    Euclid looks beyond infinity

    Euclid proves that no finite list can contain every prime. Multiply the primes on a list and add 1: some prime divisor of that new number is missing from the list. The new number need not itself be prime.

    Eratosthenes makes a sieve

    Rather than test each number separately, systematically cross out multiples of primes. A method attributed to Eratosthenes still makes a remarkably good introduction to algorithms today.

    Mersenne explores powers of two

    Marin Mersenne studies numbers of the form 2p − 1. His proposed list of prime-producing exponents contains mistakes, but the numbers now bear his name.

    Euler breaks a convincing pattern

    Fermat suspected every number of the form 22n + 1 was prime. Euler shows that 232 + 1 = 641 × 6,700,417. A few successful examples are not a proof.

    The Prime Number Theorem

    Hadamard and de la Vallée-Poussin independently prove that the count of primes up to x is asymptotic to x / ln(x). Around a large x, prime density is roughly 1 / ln(x).

    A global search begins

    George Woltman starts the Great Internet Mersenne Prime Search: GIMPS. Volunteers contribute computing power to a search far bigger than any one computer.

    41 million digits. One new prime.

    Luke Durant's GIMPS search confirms 2136,279,841 − 1, with 41,024,320 decimal digits. His network uses thousands of server GPUs spanning 24 datacenter regions in 17 countries.

    The search continues

    The 2024 discovery remains the largest known prime in the PrimePages list checked on this date. There are infinitely many primes, but only finitely many that we have identified.

    Read more: MacTutor's history of prime numbers · GIMPS discovery report · PrimePages records.

    03 / Get to know the neighbors

    1,000 integers.
    168 primes.

    Explore every prime from 1 to 1,000, grouped into blocks of 100. Open a range to see its numbers. The list is generated by the same sieve principle you can try in the lab.

    A small surprise: the block from 91 to 100 has just one prime: 97. Primes are predictable in their overall density, but not evenly spaced.
    Try the sieve before moving on ↗Level 02: Patterns & discovery →