Prime Numbers & Divisibility

The atoms of arithmetic — primes are the building blocks of all integers.

Prime Numbers

A prime p > 1 has exactly two divisors: 1 and itself. The first primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, …

2 is the only even prime — every even number > 2 is divisible by 2. To test if n is prime, check divisibility by primes up to √n (why? if n = a·b, one factor must be ≤ √n).

Primes are the foundation of modern cryptography and connect deeply to factoring in algebra.

Fundamental Theorem of Arithmetic

Every integer n > 1 has a unique prime factorization:
n = p₁^a₁ · p₂^a₂ · … · pₖ^aₖ

Example: 360 = 2³ · 3² · 5

360 ÷ 2 = 180 → 180 ÷ 2 = 90 → 90 ÷ 2 = 45 → 45 ÷ 3 = 15 → 15 ÷ 3 = 5 → 5 ÷ 5 = 1

Divisors of 360: (3+1)(2+1)(1+1) = 24 divisors

nYJ2cI6OCbWgAp23HLvlDLp2tAAS2sK2tnwUkdMG1Fo93zgN7uCFjtRm6XBJylg8AXCah84UFR6otofwuz6n2Zdc0A8BWA1a9pbppqsfVd8FlenrYDzUph2INVBqXiRMvqejG/rVl/IE7st5a+HLoOBO3K045KGE5H3XkkdJkmjO+sgEAUstmIfobWQ0jnbrsul/6k0Mue6gIHa+s7Ks6bNndtR7IZVMKM8NF04Dsiai8NQQyC3Xtx0+L9b4w+8pXDMk/hYOVSyxpC+czhjVM72tcFfHbaxqSbmvFjcdTh6DnAn/6XQU5TDaXlXypAJ80K6JLo+lzFR+qtRd3iwXcBYxFjzZusBGPA7WzXScRewyd8Bt44zHsiaXevTgOqLAOt+Fr5/A1yaeHG1vIHARjont4QIp1Ye0TrfcPfPsqnoYki7cZhFjdDTCbNM90ai0bkItp+QvaR2CY3+VxwmiJv92jWKk+07sJH3IqRLzKNbIjCmlw5HYY8+c8HOgF3Qy2p6xB2yx67xYRF2kMt24nlzG2F5iKYd3iB+bp42fbW4cWQFDwnx9ou6s/h40nCseZ+rPCkyOGGeLiNJ3+xwFGRcqO6FBsbAZjZoyUhBm7cGVOpjIY4LXT+viiSO3gY3oQkKCP0omFnnGr7mB+vcYh4NKlQOl2ACMqFVzavZxwn6ztdiv1en0U2ZA02Ce0KcSjvk/ClRT4Wxc3VN1owZ3JEekyquMOuIHk/qON3ih2y4145Uz

GCD & LCM

GCD(a, b) = product of common primes with min exponents
LCM(a, b) = product of all primes with max exponents
a · b = GCD(a, b) · LCM(a, b)

Euclidean Algorithm computes GCD efficiently: GCD(a, b) = GCD(b, a mod b). This is one of the oldest algorithms — and it's essential in modular arithmetic for finding modular inverses.

k5BLZJPu1OEMztPko+FGOzHDg6spj9KaMHa0Zn2dLnQIdBnR8CO/RkZZqoVWpY+yn/6JJtzTQhynEFf6aGrdc6B5bRd1ss41ZikUFBnzmYDuxWy9aFgW9BCwMFSyAssplVTDMhKtMM6uelssH+ti85gQYfRUUzRd/AdnXMZre6ynDg20+sBsPPojnzcPd0axPDJ4dutqBvUoIg5GHIOYpqLx5iD8gg7W9CrzGIiPNpe5zLdSoKqifnvEZyw7opKKvBHT2z9kseDG14A79hX/YZ7VL5AjxNBOqBdW/PJ/oH4vdtSgCpZA83VCOTtNU5KC/+eEdXippT/HLPM24+MMEd/uU5f/ifgL/teEwx9VRCPGjSDMZtU5jnTbJbfkDrc9rhFaV0RRKP+Uzwi7XuRPTX8Ziyyc2iT6O9S506TfjhpdHrVEZqOqWy+CpqBEFn2urpc3jwMzCy9Y6rOP3Gv9emt5V9liguqLB+7ZpT5xSQ1MkTogfwLV30CM+KynTUkScyei7PXXDjsGMYCtN0hfndZ+ZDlrcvIKz1dDtFaVpY43AMaHAgb9ewiVRCUaq20B/C+BMdju61OXzIBCKSpEg0eBzMRHY8aa+FDPWaqsPG8Evn7tbKfF81t1tWQstSPqnRIq4c1uD9OcG0c84qq57f03P4aESfkm8hgFGFpjIorjamNh66okjDMIeF6pY23fCQrjQyHB0pnOpvNf4FXxz91egjDqJwH/OR0xWWk5cMmp68g

The Sieve of Eratosthenes

To find all primes ≤ n: start with 2, mark all multiples of 2, next unmarked (3), mark all multiples of 3, continue to √n. The remaining unmarked numbers are prime. Complexity: O(n log log n).

Distribution of Primes

The Prime Number Theorem: π(n) ≈ n/ln(n), where π(n) counts primes ≤ n. This connects primes to logarithmic functions and limits. There are infinitely many primes (Euclid's proof by contradiction is one of the most elegant in mathematics).

Open problems: the Twin Prime Conjecture (infinitely many primes p where p+2 is also prime), Goldbach's Conjecture (every even n > 2 is the sum of two primes), and the Riemann Hypothesis (about the precise distribution of primes).