Prime
A positive integer greater than 1 with exactly two positive divisors: 1 and itself. The divisors of 7 are just 1 and 7.
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
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.
A positive integer greater than 1 with exactly two positive divisors: 1 and itself. The divisors of 7 are just 1 and 7.
An integer greater than 1 with more than two positive divisors. The divisors of 12 are 1, 2, 3, 4, 6, and 12.
1 has exactly one positive divisor: itself. It is neither prime nor composite. Zero and negative integers are not primes in this setting either.
84 = 2 × 2 × 3 × 7. This is the Fundamental Theorem of Arithmetic.A reason to care / Beginner
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.
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.
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.
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
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.
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.
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.
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
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.
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
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.
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.
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.
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.
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
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.
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.
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.
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.
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).
George Woltman starts the Great Internet Mersenne Prime Search: GIMPS. Volunteers contribute computing power to a search far bigger than any one computer.
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 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
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.