Prime Number

Arithmetic

A prime number is a whole number greater than 1 that can only be divided evenly by 1 and itself.

Visualization

Definition

A prime number is a counting number bigger than $1$ that can only be divided evenly by $1$ and itself, having exactly two positive divisors. The number $1$ is neither prime nor composite, and by the Fundamental Theorem of Arithmetic, every integer greater than $1$ is either prime or a unique product of primes. Formally, a prime $p$ in $\mathbb{Z}$ is an irreducible element: if $p \mid ab$ then $p \mid a$ or $p \mid b$.

Example

$7$ is prime, since only $1 \times 7 = 7$, but $6$ is not, since $2 \times 3 = 6$ gives it four factors. $13$ is prime (divisors: $1, 13$), while $15$ is composite (divisors: $1, 3, 5, 15$); primes up to $30$ are $2, 3, 5, 7, 11, 13, 17, 19, 23, 29$. Mersenne primes take the form $2^p - 1$ (for example, $2^7 - 1 = 127$), and RSA encryption relies on the hardness of factoring $n = pq$ for large primes $p, q$.

Key Insight

Think of primes as numbers that cannot be arranged into a rectangle of more than one row: $7$ dots can only be arranged as $1$ row of $7$. $2$ is the only even prime, and the Sieve of Eratosthenes finds all primes up to $n$ by crossing out multiples of each prime starting at $2$. Primes are the "atoms" of multiplication in $\mathbb{Z}$; the Prime Number Theorem states $\pi(n) \sim n / \ln(n)$ where $\pi(n)$ counts primes up to $n$, and the Riemann Hypothesis, if proved, would give the tightest known bound on the error in that theorem.