Number Theory Basics
Number theory is the study of the integers and their arithmetic structure: divisibility, primes, congruences, and Diophantine equations. Key result: every integer factors uniquely into primes (the Fundamental Theorem of Arithmetic). Applies to: cryptography, coding theory, computer science, and pure mathematics. Origins: Euclid (c. 300 BCE), systematized by Gauss in Disquisitiones Arithmeticae (1801).Number theory begins with the deceptively simple set and asks deep questions about multiplicative and additive structure. At its foundation lie divisibility (when does one integer evenly divide another), prime numbers (the multiplicative atoms), and congruences (arithmetic "modulo "). It matters because the simplest-stated problems — e.g., "are there infinitely many twin primes?" — can resist solution for centuries, and because modular arithmetic underpins virtually all modern public-key cryptography. A surprising fact: although primes thin out among large integers, they never run out, and Euclid proved this with a one-line argument over two millennia ago.
The Core Insight
The integers form a structure where addition is simple but multiplication is profound. The primes are the indecomposable building blocks under multiplication, and the Fundamental Theorem of Arithmetic says every integer is uniquely assembled from them. Most of elementary number theory flows from two engines: the division algorithm (which controls divisibility and the GCD) and modular arithmetic (which packages divisibility relations into a clean algebraic system ).
Formal Statement
Divisibility
For integers with , we say divides , written , if there exists an integer such that:
Here is a divisor (or factor) of , and is a multiple of . Basic properties: (reflexive on nonzero ); if and then (transitive); if and then for all (linearity).
Prime and Composite
An integer is prime if its only positive divisors are and . An integer that is not prime is composite. The number is a unit and is neither prime nor composite.
Division Algorithm
For any integers and with , there exist unique integers (quotient) and (remainder) such that:
Fundamental Theorem of Arithmetic
Every integer can be written as a product of primes, and this representation is unique up to the order of the factors:
Greatest Common Divisor and Bézout's Identity
The greatest common divisor is the largest positive integer dividing both and . Bézout's identity states there exist integers with:
Two integers are coprime (relatively prime) if .
Congruence Modulo n
For a positive integer , integers and are congruent modulo , written , if:
Congruence is an equivalence relation that respects addition and multiplication, partitioning into residue classes forming the ring .
Fermat's Little Theorem
If is prime and , then:
Euler's Theorem
If , then , where Euler's totient counts integers in coprime to :
Chinese Remainder Theorem
If are pairwise coprime, the system has a unique solution modulo the product:
Why It Holds
Euclid's Theorem: Infinitely Many Primes
We show no finite list of primes is complete.
- Suppose, for contradiction, that there are only finitely many primes: .
- Form the integer .
- By the Fundamental Theorem of Arithmetic, has at least one prime divisor .
- If were one of the listed primes , then , which is impossible since no prime divides .
- Therefore is a prime not in our list — contradicting the assumption that the list was complete.
- Hence the set of primes is infinite.
Euclidean Algorithm computes the GCD
The algorithm repeatedly applies the division algorithm to find .
- Given , write with (equation [2]).
- Key lemma: . Proof: any common divisor of divides ; any common divisor of divides . The two pairs share the same divisors, hence the same greatest one.
- Replace by and repeat. The remainders strictly decrease: .
- Since a strictly decreasing sequence of nonnegative integers must terminate, some remainder reaches .
- When , we have , the last nonzero remainder.
Carl Friedrich Gauss | 1777–1855
Gauss called mathematics "the queen of the sciences" and number theory "the queen of mathematics." At age 24 he published Disquisitiones Arithmeticae (1801), which introduced the congruence notation , systematized modular arithmetic, proved the law of quadratic reciprocity (which he called the aureum theorema, golden theorem, and proved in multiple ways throughout his life), and laid the foundations for algebraic number theory. His insistence on rigorous proof transformed number theory from a collection of clever observations into a coherent discipline. He reputedly remarked that he discovered the prime-counting estimate as a teenager.
Building Intuition
Think of the primes as a periodic table of integers: every number is a unique molecule built from prime atoms. The exponents in the prime factorization [3] are coordinates locating each integer in an infinite-dimensional grid (one axis per prime). Divisibility then means 's coordinates are all 's, coordinate-by-coordinate — the GCD takes the minimum exponent in each slot, the LCM takes the maximum. Modular arithmetic, meanwhile, is just clock arithmetic: on a 12-hour clock, because . The Chinese Remainder Theorem says that knowing the time on several coprime clocks (mod 7, mod 11, mod 13) pins down the absolute "time" uniquely up to the product .
The sieve of Eratosthenes: composites struck out as multiples of each prime, leaving primes (gold) standing.
Worked Examples
Solving a Linear Congruence with the Extended Euclidean Algorithm
Given: Solve . Step 1 — Find the inverse of 17 mod 43. Apply the Euclidean algorithm:- , so (an inverse exists).
- .
So , giving .
Step 3 — Multiply both sides by the inverse:Fast Modular Exponentiation via Fermat's Little Theorem
Given: Compute . Step 1 — Apply Fermat's Little Theorem (equation [6]). Since is prime and :Common Misconceptions
"The number 1 is prime." It is not. Declaring prime would destroy the uniqueness in the Fundamental Theorem of Arithmetic ([3]), since you could append any number of factors of (e.g., ). The number is a unit: it has a multiplicative inverse and is excluded from the primes precisely to preserve unique factorization. " lets you always cancel a common factor." Cancellation is only valid when the factor is coprime to the modulus. From , you may not divide by to conclude via carelessly. The correct rule: if then . The converse of Fermat's Little Theorem fails. One might hope that for some guarantees is prime. But is composite, yet . Such are called Fermat pseudoprimes (base 2). Worse, Carmichael numbers like satisfy for every coprime to , fooling the Fermat test for all bases. This is why probabilistic primality tests use the stronger Miller–Rabin criterion.Connections
Number theory sits at a crossroads of mathematics. The ring and the group of units are the entry point to Abstract Algebra, where the GCD's Bézout identity reappears as the theory of ideals in Principal Ideal Domains. The distribution of primes, captured by the Prime Number Theorem , links elementary number theory to Complex Analysis through the Riemann zeta function. Quadratic reciprocity opens into Algebraic Number Theory, where unique factorization is recovered for ideals when it fails for elements. Congruences and the Chinese Remainder Theorem are the computational heart of Cryptography and Coding Theory.
Real-World Applications
- RSA public-key cryptography — security rests on the difficulty of factoring a product of two large primes; decryption uses Euler's Theorem ([7]) with exponents reduced mod .
- Diffie–Hellman key exchange — relies on modular exponentiation ([6]) and the hardness of the discrete logarithm in .
- Error-correcting codes — Reed–Solomon codes (used in CDs, DVDs, QR codes, and deep-space communication) are built over finite fields , direct generalizations of .
- Hash tables and hashing — modular reduction with prime distributes keys uniformly and reduces clustering.
- Check digits — the ISBN-10 checksum and credit-card Luhn algorithm use congruences mod 11 and mod 10 to detect transcription errors.
- Cryptographic random number / primality — the Miller–Rabin test (built on Fermat's Little Theorem) certifies the large primes underlying TLS/HTTPS.
- Computer arithmetic — the Chinese Remainder Theorem ([8]) accelerates large-integer multiplication by computing modulo several small coprime moduli in parallel.
Historical Development
- c. 1800 BCE — Babylonian tablet Plimpton 322 lists Pythagorean triples, an early Diophantine table.
- c. 300 BCE — Euclid's Elements (Books VII–IX) gives the Euclidean algorithm, the proof of infinitely many primes, and the link between primes and perfect numbers.
- c. 250 CE — Diophantus of Alexandria writes Arithmetica, founding the study of integer/rational solutions of equations.
- 1640 — Pierre de Fermat states his "Little Theorem" and his famous "Last Theorem" margin note; corresponds prolifically on number theory.
- 1736 — Leonhard Euler proves Fermat's Little Theorem and introduces the totient function .
- 1801 — Gauss publishes Disquisitiones Arithmeticae, introducing congruence notation and proving quadratic reciprocity.
- 1837 — Dirichlet proves infinitely many primes in any arithmetic progression with , launching analytic number theory.
- 1859 — Riemann's eight-page memoir connects to the zeros of , posing the Riemann Hypothesis.
- 1896 — Hadamard and de la Vallée Poussin independently prove the Prime Number Theorem.
- 1994 — Andrew Wiles proves Fermat's Last Theorem via modularity of elliptic curves, vindicating Fermat's 1637 claim.
Subtleties & Limits
Many of number theory's most natural questions remain open. The Riemann Hypothesis — that all nontrivial zeros of have real part — controls the finest error term in the distribution of primes and is one of the seven Millennium Prize Problems. The Twin Prime Conjecture asserts infinitely many pairs of primes; Yitang Zhang (2013) proved bounded gaps occur infinitely often, later sharpened by the Polymath project to gaps of size , but the gap of remains unproven. Goldbach's Conjecture (every even integer is a sum of two primes) is verified to enormous bounds but unproven. The abc conjecture, deciding the structure behind additive-multiplicative interactions, has a disputed claimed proof. These show that the integers, the simplest objects in mathematics, still harbor profound mysteries.