Number Theory

Number theory is the study of the integers and their generalisations — divisibility, primes, congruences, Diophantine equations, algebraic integers, and the deep arithmetic of rational points on varieties. It is the oldest branch of pure mathematics (Euclid’s Elements, c. 300 BC, proved the infinitude of primes and the fundamental theorem of arithmetic) and the source of some of the most consequential modern results: Andrew Wiles’s 1995 proof of Fermat’s Last Theorem, the prime number theorem (Hadamard / de la Vallée Poussin 1896), the proofs of the Weil conjectures (Deligne 1974), and the partial results toward the Langlands program. It is also the source of practically every cryptographic primitive deployed at scale — RSA, elliptic-curve cryptography, lattice-based post-quantum schemes, isogeny-based protocols — and so connects deep abstract mathematics to the most quotidian engineering. This note covers divisibility and the Euclidean algorithm, primes and the distribution theorems, congruences, Fermat-Euler-Wilson, multiplicative functions, Dirichlet series and -functions, quadratic reciprocity, an algebraic-number-theory primer, elliptic curves, modular forms, the Wiles proof outline, and cryptographic applications.

See also

1. Divisibility and the Euclidean algorithm

1.1 Divisibility

For with , ( divides ) means for some . The divisibility relation is reflexive, transitive, and antisymmetric on .

1.2 Greatest common divisor

For not both zero, is the largest positive integer dividing both. By convention , .

Bézout’s identity (Étienne Bézout 1779): there exist with . The coefficients are not unique but the gcd is.

1.3 Euclidean algorithm

Euclid c. 300 BC. Compute by iteration: with each . The last nonzero remainder is . Reverses to give Bézout coefficients via back-substitution.

Complexity: at most iterations (Gabriel Lamé 1844 showed the worst case is consecutive Fibonacci numbers). Each iteration costs bit operations naively, or with fast multiplication. Total: bit operations on -bit inputs, improvable to via Schönhage’s half-gcd.

1.4 Least common multiple

.

2. Primes and the fundamental theorem

2.1 Primes

A prime is an integer whose only positive divisors are and . Smallest primes: .

Euclid’s theorem: there are infinitely many primes. Proof: given primes , the number is either prime or has a prime factor not among the . Either way we get a new prime.

2.2 Fundamental theorem of arithmetic

Every integer factors uniquely (up to order) as a product of primes: Existence is straightforward by induction. Uniqueness uses Euclid’s lemma: if is prime and , then or .

2.3 Mersenne, Fermat, and other special primes

  • Mersenne primes: prime, prime. As of 2024, 52 known; the largest known prime is a Mersenne prime ( found 2018). Conjecturally infinitely many.
  • Fermat primes: . Only known to be prime; (Euler 1732).
  • Twin primes: pairs . Conjecturally infinitely many (Polignac 1849). Yitang Zhang 2013 Annals of Math 179: there are infinitely many prime pairs differing by at most . The Polymath8 project + James Maynard reduced this to 246.
  • Sophie Germain primes: such that is also prime.

3. Prime distribution

3.1 Prime counting function

= number of primes . Sample values: , , , .

3.2 Prime number theorem

Conjectured by Gauss (age 14, 1792) and Legendre (1798); proven independently by Jacques Hadamard 1896 and Charles-Jean de la Vallée Poussin 1896:

Equivalently . The error term is best-stated using the latter: unconditionally (de la Vallée Poussin), and under the Riemann hypothesis (Helge von Koch 1901).

3.3 The Riemann hypothesis

Riemann 1859 conjectured that all non-trivial zeros of have real part . Equivalent: . Eighth Hilbert problem (1900), first Clay Millennium Prize problem. Verified for the first zeros (van de Lune et al. and successors); widely believed.

3.4 Other distribution results

  • Chebyshev (1852): .
  • Bertrand’s postulate (Chebyshev 1850, conjectured Bertrand 1845): for every there is a prime in .
  • Dirichlet’s theorem on primes in APs (Peter Gustav Lejeune Dirichlet 1837): for , there are infinitely many primes , distributed equally among residue classes coprime to :
  • Green-Tao theorem (Ben Green and Terence Tao 2008 Annals of Math 167): the primes contain arbitrarily long arithmetic progressions.

4. Congruences

4.1 Definition

means . The relation is an equivalence relation; the quotient is a finite commutative ring of order . The multiplicative group of units is , of order .

4.2 Chinese Remainder Theorem

Sun Tzu c. 4th century AD (in special cases); general statement clear by the 13th century. For pairwise coprime : via . The system has a unique solution mod .

Algorithmic version: use Bézout coefficients of and to construct the explicit solution.

4.3 Fermat’s little theorem

Pierre de Fermat 1640 (no proof); first proof by Euler 1736. For prime and with : Equivalently for all .

4.4 Euler’s theorem

Leonhard Euler 1763. For : Generalises Fermat’s little theorem (case ). The Euler totient .

4.5 Wilson’s theorem

John Wilson 1770 (conjecture), Lagrange 1771 (proof). For prime : Converse holds: this is a primality test. Computationally inefficient ( vs for AKS) but theoretically elegant.

4.6 Order of an element

The order of is the smallest with . Divides . For prime , is cyclic of order (Gauss); a generator is a primitive root mod .

5. Multiplicative functions

5.1 Definitions

is multiplicative if whenever . Completely multiplicative if the condition holds for all .

5.2 Key examples

  • for all .
  • for any complex .
  • — Euler’s totient.
  • . Special cases: (number of divisors), (sum of divisors).
  • — Möbius function: , if is a product of distinct primes, if has a squared prime factor.
  • — von Mangoldt function (not multiplicative): , otherwise.

5.3 Dirichlet convolution

For arithmetic functions : This is associative and commutative, with identity . The space of arithmetic functions with Dirichlet convolution is a commutative ring; multiplicative functions form a subgroup under convolution.

5.4 Möbius inversion

August Ferdinand Möbius 1832. If (i.e., ), then (i.e., ). Equivalently in the Dirichlet convolution ring.

Examples:

  • , so .
  • .
  • .

6. Dirichlet series and -functions

6.1 Dirichlet series

For an arithmetic function : Converges absolutely in a right half-plane for some .

Convolution becomes multiplication: .

6.2 Riemann zeta function

. Euler product (1737): This is the analytic translation of unique factorisation.

See complex-analysis for analytic continuation, functional equation, and the Riemann hypothesis.

6.3 Dirichlet -functions

For a Dirichlet character (extended by zero):

Non-trivial extends analytically to (entire if is non-principal). Non-vanishing at is equivalent to Dirichlet’s theorem on primes in APs. Generalised Riemann hypothesis (GRH): all non-trivial zeros lie on .

6.4 Dedekind zeta function

For a number field : summing over nonzero ideals and primes of . Generalises . Class number formula relates the residue at to the class number, regulator, discriminant, and unit group of .

6.5 The Selberg class and the Langlands program

Atle Selberg 1992 axiomatised the class of “nice” -functions (functional equation, analytic continuation, Euler product, Ramanujan-Petersson bound). The Langlands program (Robert Langlands 1967 letter to Weil) predicts a vast unification: -functions of automorphic representations of correspond to -functions of -dimensional Galois representations. Many cases are now theorems (Wiles for , much of in the function-field case via Drinfeld-Lafforgue, recent advances by Fargues-Scholze 2024).

7. Quadratic reciprocity

7.1 Legendre symbol

For odd prime and with : Euler’s criterion: .

7.2 Quadratic reciprocity

Conjectured Euler-Legendre 18th century; first proof Gauss 1796 (age 19). Gauss produced 8 distinct proofs; over 240 published proofs now exist.

For distinct odd primes : Supplements: and .

7.3 Jacobi symbol

Extends Legendre to all odd : for . Reciprocity extends. Computable in without factoring — central in primality testing (Solovay-Strassen).

7.4 Higher reciprocity

Cubic reciprocity (Gauss / Eisenstein), biquadratic reciprocity, and the general statement subsumed by class field theory (Takagi 1920, Artin 1927): the abelian extensions of a number field are classified by ideal class groups / idele class groups. Quadratic reciprocity emerges as the case of quadratic extensions of and the Artin reciprocity isomorphism. Modern non-abelian generalisation: the Langlands program.

8. Algebraic number theory primer

8.1 Algebraic integers and number fields

A number field is a finite-degree field extension of . The ring of integers is the set of satisfying a monic polynomial in .

Examples:

  • : .
  • : (Gaussian integers).
  • : .
  • : . Not a UFD: .
  • with : — cyclotomic field.

8.2 Failure of unique factorisation; ideals

The Gaussian integers are a UFD (Gauss). But many are not — the example above with failed Kummer’s attempts to prove FLT. Ernst Eduard Kummer’s insight (1847): factor ideals instead of elements. In every nonzero ideal factors uniquely as a product of prime ideals — a Dedekind domain.

8.3 Class group

The ideal class group , where is the group of fractional ideals and the principal fractional ideals, is a finite abelian group. The class number measures the failure of unique factorisation of elements.

  • iff is a PID iff UFD.
  • For with squarefree: for exactly nine values (Heegner 1952, Stark-Baker 1966).
  • Gauss class number problem for real quadratic fields (, ) — conjectured infinitely many with ; still open.

8.4 Units

is described by Dirichlet’s unit theorem (Dirichlet 1846): where is the group of roots of unity in (finite), = number of real embeddings, = number of conjugate pairs of complex embeddings.

For real quadratic : , generated by and a fundamental unit. Computing the fundamental unit is equivalent to solving Pell’s equation .

8.5 Splitting of primes

For a prime and a number field : with where is the residue degree. Behaviour types: split (all , large), inert (, , ), ramified (some ).

For quadratic : splits, is inert, or ramifies according to the value of — Legendre/Kronecker symbol with the discriminant. Quadratic reciprocity governs the splitting.

9. Elliptic curves

9.1 Definition

An elliptic curve over a field (char ) is a smooth projective curve of genus with a marked point. Affine form: The smoothness condition is .

9.2 Group law

The set of -rational points is an abelian group with the marked point (at infinity) as identity. Geometrically: iff are collinear (counted with multiplicity).

Explicit formulas (chord-tangent construction):

  • has the same -coordinate, negated .
  • For with : slope if , if . Then , .

9.3 Mordell-Weil theorem

Louis Mordell 1922 for , André Weil 1929 for general number fields: for a number field . Here is the (finite) torsion subgroup and is the rank.

  • Torsion is classified: Barry Mazur 1977 (Inventiones) for — only 15 possible groups. The largest is or .
  • Rank: no known algorithm to compute in general. Maximum known rank for is (Elkies 2006). Conjecturally rank is unbounded — Bhargava-Skinner-Zhang show has rank or “most of the time” (in a precise sense over the family of elliptic curves ordered by height).

9.4 Birch-Swinnerton-Dyer conjecture

Bryan Birch and Peter Swinnerton-Dyer 1965, based on numerical computations on the EDSAC. Statement: for , the rank of equals the order of vanishing of at : The leading coefficient is given by a precise formula involving the Tamagawa numbers, regulator, , and the Tate-Shafarevich group .

Status: known for rank and (Coates-Wiles 1977; Kolyvagin 1989, plus Gross-Zagier 1986). Open for higher ranks. Clay Millennium Prize problem.

9.5 Reduction mod and the Hasse bound

For and a prime of good reduction: (Helmut Hasse 1933, proved as an analogue of the Riemann hypothesis for curves over finite fields).

The function governs the -function: for primes of good reduction, with adjusted Euler factors at bad primes.

10. Modular forms

10.1 Definition

A modular form of weight for is a holomorphic function (upper half-plane) with:

  1. for .
  2. Bounded as (“holomorphic at the cusp”).

A cusp form additionally vanishes at the cusp.

The space of weight- modular forms is finite-dimensional; is given by an explicit formula (zero unless is even non-negative).

10.2 Eisenstein series

Modular form of weight . The space for is spanned by products .

10.3 Discriminant cusp form

Weight-12 cusp form; unique up to scalar. The Fourier coefficients are the Ramanujan tau function. Ramanujan-Petersson conjecture: — proved by Deligne 1974 as a consequence of the Weil conjectures.

10.4 Hecke operators

Erich Hecke 1937. Operators acting on modular forms. Their eigenforms have multiplicative Fourier coefficients. The simultaneous eigenforms (Hecke eigenforms) are the “atoms” — they give rise to -functions:

10.5 Modularity theorem (Taniyama-Shimura-Weil)

Statement: every elliptic curve is modular: there is a weight-2 cusp form for ( = conductor of ) such that .

Wiles 1995 Annals of Math 141 proved the semistable case (sufficient for FLT). Breuil-Conrad-Diamond-Taylor 2001 Journal of the AMS 14 completed the general case.

11. Fermat’s Last Theorem

11.1 Statement

Pierre de Fermat 1637 marginal note in his copy of Diophantus: has no solution in positive integers for . The note’s claim of a proof was almost certainly mistaken.

11.2 Historical attempts

  • Fermat: proof for (infinite descent).
  • Euler 1770: (with gap in unique factorisation, later filled).
  • Dirichlet, Legendre: .
  • Lamé 1839: (very intricate).
  • Kummer 1850s: regular prime — succeeded for many but failed at irregular primes.
  • 20th century: computational verification up to (Buhler-Crandall-Sompolski 1992 and beyond).

11.3 Wiles’s proof outline

The reduction was discovered by Gerhard Frey 1986 and made precise by Ribet 1990 (epsilon conjecture).

  1. Frey curve: if is a hypothetical solution with prime, form the elliptic curve .
  2. Ribet’s theorem: would be “not modular” in a specific sense (the corresponding mod- Galois representation would not arise from a modular form of weight and the right level).
  3. Modularity theorem (Wiles): every semistable is modular.
  4. Contradiction: is semistable, hence modular, contradicting step 2.

The proof of modularity occupies hundreds of pages and uses deformation theory of Galois representations, theorems (Wiles, Taylor-Wiles), and a Galois-cohomological obstruction calculus. A widely accessible exposition: Cornell, Silverman, Stevens (eds.) Modular Forms and Fermat’s Last Theorem 1997.

12. Cryptography

12.1 RSA

Rivest-Shamir-Adleman 1977 (and Clifford Cocks 1973, independently at GCHQ, declassified 1997). Choose primes , compute and . Pick public exponent coprime to and private . Public key ; private key .

Encryption: . Decryption: , valid by Euler’s theorem.

Security rests on the hardness of integer factorisation. Best classical algorithm: General Number Field Sieve (Pollard 1988, Buhler-Lenstra-Pomerance 1993), subexponential complexity . Current key sizes: 2048-3072 bit for long-term security, 4096-bit for high-security.

12.2 Elliptic-curve cryptography

Neal Koblitz 1987 / Victor Miller 1985 (independent). Use for cryptographic primitives. Discrete log problem: given , find with .

Best generic attack: Pollard rho, where . No subexponential attack for “generic” curves (unlike ).

Practical curves: P-256 (NIST), secp256k1 (Bitcoin, Ethereum), Curve25519 (Daniel Bernstein 2005, used in TLS 1.3 / Signal). 256-bit ECC gives roughly the same security as 3072-bit RSA, with much smaller keys and faster operations.

12.3 Pairing-based cryptography

Bilinear pairings on elliptic curves (Weil pairing, Tate pairing). Enable identity-based encryption (Boneh-Franklin 2001), short signatures (BLS — Boneh-Lynn-Shacham 2001), and the foundations of zk-SNARKs in many SNARK schemes (Groth16, KZG commitments). Used in Ethereum precompiles (BN254, BLS12-381).

12.4 Lattice-based post-quantum

Shor’s algorithm (Peter Shor 1994) breaks RSA and ECC on a sufficiently large quantum computer. NIST PQC standardisation 2022-2024 selected lattice-based schemes:

  • CRYSTALS-Kyber (key encapsulation), based on Module-LWE.
  • CRYSTALS-Dilithium (signatures), based on Module-LWE + Module-SIS.
  • FALCON (signatures), based on NTRU lattices.

Hardness: Shortest Vector Problem (SVP) and Closest Vector Problem (CVP) on Euclidean lattices. Best classical algorithms: BKZ lattice reduction (Schnorr 1987, refined by Chen-Nguyen 2011), running time exponential in the lattice dimension.

12.5 Isogeny-based cryptography

Use isogenies between supersingular elliptic curves. SIDH (Jao-De Feo 2011) was broken in 2022 (Castryck-Decru attack on SIDH, using Kani’s theorem). SQISign (De Feo-Kohel-Leroux-Petit-Wesolowski 2020) survives and is a NIST round-4 alternative. CSIDH (Castryck-Lange-Martindale-Panny-Renes 2018) is a slower non-broken alternative.

12.6 Other crypto primitives from number theory

  • Diffie-Hellman key exchange (1976): from . Multiplicative group of or elliptic curve.
  • DSA / ECDSA: digital signatures.
  • Schnorr signatures: simpler and provably secure; used in Bitcoin Taproot (BIP340).
  • Paillier cryptosystem: additively homomorphic; foundation of older private-set-intersection protocols.
  • Hash-to-curve: maps inputs to elliptic-curve points; foundational for BLS signatures, VRFs.

13. Diophantine approximation

13.1 Liouville’s theorem

For an algebraic of degree , there is a constant such that for all rational with : Used by Joseph Liouville 1844 to construct the first transcendental numbers (Liouville constant ).

13.2 Roth’s theorem

Klaus Roth 1955 (Fields 1958): for any algebraic irrational and , there are only finitely many with The exponent is best possible (Dirichlet shows has infinitely many solutions for any irrational ). Inexplicit — the constants depending on are not effective.

13.3 Schmidt’s subspace theorem

Wolfgang Schmidt 1972: generalises Roth to simultaneous Diophantine approximations. The far-reaching consequences include effective bounds for solutions of -unit equations and norm-form equations.

13.4 Faltings’s theorem (Mordell conjecture)

Gerd Faltings 1983 Inventiones Mathematicae 73 (Fields 1986): a smooth projective curve of genus over a number field has only finitely many rational points. Conjectured by Mordell 1922. Bombieri 1990 gave a different proof; Vojta 1991 gave a third. Effective bounds remain open.

14. Computational number theory

14.1 Primality testing

  • Fermat test: — necessary but not sufficient (Carmichael numbers fool it).
  • Miller-Rabin (Gary Miller 1976, Michael Rabin 1980): probabilistic, per round, fails with probability per round.
  • Solovay-Strassen (1977): probabilistic via Jacobi symbol.
  • AKS (Agrawal-Kayal-Saxena 2002 Annals of Math 160): first deterministic polynomial-time primality test. , later improved to . Theoretical; in practice slower than Miller-Rabin.
  • ECPP (Atkin 1986, Goldwasser-Kilian 1986): generates a primality certificate. Used for very large primes.

14.2 Integer factorisation

  • Trial division: .
  • Pollard rho (1975): expected, low memory.
  • Pollard (1974): exploits smooth .
  • Quadratic Sieve (Pomerance 1981): subexponential.
  • Number Field Sieve (Pollard 1988, GNFS 1993): subexponential . Current record: RSA-250 (829 bits) factored 2020 by Boudot et al.
  • Shor’s algorithm (1994): polynomial-time on a quantum computer. Largest reliable Shor factorisations to date are very small (15, 21, 35) — engineering, not theoretical, barrier.

14.3 Discrete logarithm

In : index calculus, similar complexity to GNFS for factoring. In small-characteristic finite fields (, ): quasi-polynomial algorithms (Barbulescu-Gaudry-Joux-Thomé 2013, Eurocrypt).

In generic groups (including elliptic curves on most curves): Pollard rho, . No subexponential attack known for properly chosen elliptic curves.

14.4 Algorithmic tools

  • Lenstra-Lenstra-Lovász (LLL) lattice basis reduction (Lenstra-Lenstra-Lovász 1982): polynomial-time approximation of shortest vector. Foundation of practical lattice cryptanalysis and many integer-relation algorithms.
  • Coppersmith’s method (1996): finding small roots of polynomials mod , leveraged in lattice attacks on RSA with small private exponent or small messages.
  • PARI/GP, SageMath, Magma, Pari, FLINT — software for computational number theory.

15. Open problems

  • Riemann hypothesis and the generalised RH for -functions.
  • Goldbach’s conjecture (1742): every even is a sum of two primes. Vinogradov 1937 proved every sufficiently large odd is a sum of three primes; Helfgott 2013 ternary Goldbach for all odd .
  • Twin prime conjecture: infinitely many both prime. Polymath/Maynard reduced the gap-of-bounded-difference to 246.
  • abc conjecture (Oesterlé-Masser 1985): for coprime, . Shinichi Mochizuki’s 2012 IUT proof is widely disputed.
  • Birch-Swinnerton-Dyer conjecture.
  • Langlands program in full generality.
  • Class number 1 problem for real quadratic fields.
  • Catalan’s conjecture: and are the only consecutive perfect powers (Mihailescu 2002).
  • Schanuel’s conjecture: transcendence-theoretic; implies many open transcendence results.

16. Connections to other libraries

  • Algebra: number theory is a major consumer of group theory (Galois groups), ring theory (Dedekind domains), and homological algebra (group cohomology).
  • Algebraic geometry: schemes over , étale cohomology, arithmetic schemes; see algebraic-geometry-foundations.
  • Complex analysis: , -functions, modular forms; see complex-analysis.
  • Combinatorics: additive combinatorics (Gowers, Tao); see graph-theory.
  • Computer science: cryptography, complexity (factoring is in NP co-NP but not known P or NP-complete), pseudo-random number generation.
  • Physics: quasi-crystal diffraction (Meyer sets and Pisot numbers); chaos at the critical line.

Further reading

  • Hardy, G. H. and E. M. Wright (Heath-Brown, Silverman, Wiles rev.). 2008. An Introduction to the Theory of Numbers (6th ed.). Oxford.
  • Ireland, K. and M. Rosen. 1990. A Classical Introduction to Modern Number Theory (2nd ed.). Springer GTM 84.
  • Marcus, D. A. 2018. Number Fields (2nd ed.). Springer.
  • Lang, S. 1994. Algebraic Number Theory (2nd ed.). Springer GTM 110.
  • Neukirch, J. 1999. Algebraic Number Theory. Springer.
  • Silverman, J. H. 2009. The Arithmetic of Elliptic Curves (2nd ed.). Springer GTM 106.
  • Silverman, J. H. 1994. Advanced Topics in the Arithmetic of Elliptic Curves. Springer GTM 151.
  • Diamond, F. and J. Shurman. 2005. A First Course in Modular Forms. Springer GTM 228.
  • Cornell, G., J. H. Silverman, G. Stevens (eds.). 1997. Modular Forms and Fermat’s Last Theorem. Springer.
  • Iwaniec, H. and E. Kowalski. 2004. Analytic Number Theory. AMS Colloquium Publications 53.
  • Davenport, H. (Montgomery rev.). 2000. Multiplicative Number Theory (3rd ed.). Springer.
  • Cohen, H. 1993. A Course in Computational Algebraic Number Theory. Springer.
  • Stein, W. 2007. Elementary Number Theory: Primes, Congruences, and Secrets. Online.
  • Tate, J. and J. Silverman. 2015. Rational Points on Elliptic Curves (2nd ed.). Springer.
  • Koblitz, N. 1994. A Course in Number Theory and Cryptography (2nd ed.). Springer.
  • Galbraith, S. D. 2012. Mathematics of Public Key Cryptography. Cambridge.

Adjacent