Folioby Interconnected
Log InSign Up

Number Theory: A Complete Summary of Definitions, Theorems, and Proofs

A single-article survey of undergraduate number theory. Covers divisibility, congruences, the Euclidean algorithm, primes, quadratic residues, arithmetic functions, continued fractions, p-adic valuations, and algebraic integers, together with all key algorithms and a dependency diagram.

FO
Folio Official
March 1, 2026

1. Introduction: How to Use This Article

This article provides a single-page panoramic view of undergraduate number theory. For each topic, we present the key definitions, major theorems, and algorithms in concise form.

How to use this page:

  • Newcomers: read the sections in order to build a coherent picture of the subject.

  • Review or exam preparation: jump to any section from the table of contents.

  • Quick algorithm lookup: Section 14, “ Theorem and Algorithm Directory,”{} collects all the major results in one list.

The dependency diagram below shows how the main topics are interrelated.

graph TD
    A["Divisibility and Congruences"] --> B["GCD and the Euclidean Algorithm"]
    A --> C["Primes and the Fundamental Theorem of Arithmetic"]
    A --> D["Applications of Congruences and Group Structure"]
    B --> D
    C --> D
    D --> E["Primitive Roots and Discrete Logarithms"]
    B --> F["The Chinese Remainder Theorem"]
    D --> F
    D --> G["Quadratic Residues"]
    E --> G
    C --> H["Arithmetic Functions"]
    B --> I["Continued Fractions"]
    C --> J["Distribution of Primes"]
    C --> K["p-adic Valuations"]
    C --> L["Algebraic Integers"]

    style A fill:#f5f5f5,stroke:#333,color:#000
    style D fill:#f5f5f5,stroke:#333,color:#000
    style F fill:#f5f5f5,stroke:#333,color:#000
    style L fill:#f5f5f5,stroke:#333,color:#000
Remark 1.
This article is designed to accompany the “ Number Theory Textbook”{} series. Links at the end of each section point to the corresponding full-length chapter for detailed exposition and complete proofs.

2. Divisibility and Congruences

Definition 2 (Divisibility).
For integers a,b with b=0, we say bdividesa (written b∣a) if there exists an integer q such that a=bq.
Theorem 3 (Division algorithm).
For any integer a and any positive integer b, there exist unique integers q and r satisfying a=bq+r with 0≤r<b.
Definition 4 (Congruence).
For integers a,b and a positive integer m, we write a≡b(modm) and say a is congruent to b modulo m if m∣(a−b).
Theorem 5 (Basic properties of congruences).
Congruence modulo m is an equivalence relation that is compatible with addition and multiplication:
  1. If a≡b(modm) and c≡d(modm), then a+c≡b+d(modm).

  2. If a≡b(modm) and c≡d(modm), then ac≡bd(modm).

For more details:

https://interconnectd.app/articles/tl9PzBamVG1DClrnfPND

3. The Greatest Common Divisor and the Euclidean Algorithm

Definition 6 (Greatest common divisor).
The greatest common divisor of integers a and b, denoted gcd(a,b), is the largest integer that divides both a and b. When gcd(a,b)=1, we say a and b are coprime.
Theorem 7 (Euclidean algorithm).
For a≥b>0, gcd(a,b)=gcd(b,amodb). When amodb=0, gcd(a,b)=b.
Theorem 8 (Bézout's identity).
For any integers a and b, there exist integers x and y such that gcd(a,b)=ax+by. These coefficients can be computed by the extended Euclidean algorithm.

Key algorithms:

  • Euclidean algorithm: computes gcd(a,b) in O(log(min(a,b))) time.

  • Extended Euclidean algorithm: simultaneously computes gcd(a,b) and the Bézout coefficients x,y in O(log(min(a,b))) time.

For more details:

https://interconnectd.app/articles/i8B2T2slxyAs04RfZwii

4. Primes and the Fundamental Theorem of Arithmetic

Definition 9 (Prime number).
An integer p≥2 is called prime if its only positive divisors are 1 and p. An integer n≥2 that is not prime is called composite.
Theorem 10 (Fundamental theorem of arithmetic).
Every integer n≥2 can be written as a product of primes, uniquely up to the order of the factors:
n=p1e1​​p2e2​​⋯pkek​​
Theorem 11 (Infinitude of primes).
There are infinitely many primes (Euclid).

Key algorithms:

  • Trial division: factors n into primes in O(n​) time.

  • Sieve of Eratosthenes: enumerates all primes up to n in O(nloglogn) time.

  • Miller–Rabin primality test: a probabilistic primality test running in O(klog2n) time (k iterations).

For more details:

https://interconnectd.app/articles/D4QlRLFTZ44RqYuw18Br

5. Applications of Congruences and the Group Structure of Residue Classes

Definition 12 (Residue class).
The equivalence classes of Z under congruence modulo m are called residue classes. The set of all residue classes is denoted Z/mZ.
Definition 13 (Group of units).
(Z/mZ)×={a∈Z/mZ∣gcd(a,m)=1} forms a group under multiplication, called the group of units (or the multiplicative group of integers modulo m).
Definition 14 (Euler's totient function).
φ(m)=∣(Z/mZ)×∣, the number of integers from 1 to m that are coprime to m, is called Euler's totient function.
Theorem 15 (Euler's theorem).
If gcd(a,m)=1, then aφ(m)≡1(modm).
Theorem 16 (Fermat's little theorem).
If p is prime and p∤a, then ap−1≡1(modp).
Theorem 17 (Wilson's theorem).
An integer p≥2 is prime if and only if (p−1)!≡−1(modp).

Key algorithms:

  • Repeated squaring (binary exponentiation): computes anmodm in O(logn) time.

  • Modular inverse: when gcd(a,m)=1, computed via the extended Euclidean algorithm, or via Fermat's little theorem as ap−2modp when m=p is prime.

For more details:

https://interconnectd.app/articles/lTZdM37Wgc5RIzEiJ2tN

6. Primitive Roots and Discrete Logarithms

Definition 18 (Multiplicative order).
When gcd(a,m)=1, the smallest positive integer k satisfying ak≡1(modm) is called the multiplicative order of a modulo m, denoted ordm​(a).
Definition 19 (Primitive root).
If ordm​(a)=φ(m), then a is called a primitive root modulo m.
Theorem 20 (Existence of primitive roots).
A primitive root modulo m exists if and only if m=1,2,4,pk, or 2pk, where p is an odd prime and k≥1.
Definition 21 (Discrete logarithm).
When g is a primitive root modulo m, the integer x satisfying gx≡a(modm) is called the discrete logarithm of a to the base g, written indg​a.
Theorem 22 (Number of primitive roots).
When a primitive root modulo m exists, the total number of primitive roots modulo m is φ(φ(m)).

Key algorithms:

  • Baby-step giant-step: solves the discrete logarithm problem gx≡a(modp) in O(p​) time and space.

For more details:

https://interconnectd.app/articles/cg1LJsuTDD1fAw6DMD4H

7. The Chinese Remainder Theorem and Applications

Theorem 23 (Chinese remainder theorem (CRT)).
If m1​,m2​,…,mk​ are pairwise coprime (gcd(mi​,mj​)=1 for i=j), then the system of simultaneous congruences
x≡a1​(modm1​),x≡a2​(modm2​),…,x≡ak​(modmk​)
has a unique solution modulo M=m1​m2​⋯mk​.
Theorem 24 (Ring isomorphism).
When gcd(mi​,mj​)=1 for all i=j, there is a ring isomorphism
Z/MZ≅Z/m1​Z×Z/m2​Z×⋯×Z/mk​Z

Key algorithms:

  • Constructive CRT: setting Mi​=M/mi​, the solution is x≡∑i=1k​ai​Mi​(Mi−1​modmi​)(modM) in O(klogM) time.

  • Garner's algorithm: applies the CRT incrementally, avoiding overflow for large M, in O(k2) time.

For more details:

https://interconnectd.app/articles/cdLXHKAHUWG27KrVJ2wO

8. Quadratic Residues and Reciprocity

Definition 25 (Quadratic residue).
Let p be an odd prime. If gcd(a,p)=1 and the congruence x2≡a(modp) has a solution, then a is called a quadratic residue modulo p; otherwise, a is a quadratic nonresidue.
Definition 26 (Legendre symbol).
(pa​)=⎩⎨⎧​1−10​if a is a quadratic residue modulo pif a is a quadratic nonresidue modulo pif p∣a​
Theorem 27 (Euler's criterion).
(pa​)≡a(p−1)/2(modp)
Theorem 28 (Law of quadratic reciprocity (Gauss)).
For distinct odd primes p and q,
(qp​)(pq​)=(−1)2p−1​⋅2q−1​
Theorem 29 (First and second supplements).
(p−1​)=(−1)(p−1)/2,(p2​)=(−1)(p2−1)/8

Key algorithms:

  • Tonelli–Shanks algorithm: finds a solution to x2≡a(modp) in O(log2p) time.

For more details:

https://interconnectd.app/articles/iVThwiqRtPK0X11EGjo5

9. Arithmetic Functions and Multiplicativity

Definition 30 (Arithmetic function).
A complex-valued function f:Z>0​→C defined on the positive integers is called an arithmetic function.
Definition 31 (Multiplicative function).
An arithmetic function f with f(1)=1 is called multiplicative if f(mn)=f(m)f(n) whenever gcd(m,n)=1. It is called completely multiplicative if f(mn)=f(m)f(n) for all positive integers m,n.
Definition 32 (Important arithmetic functions).
  • Euler's totient functionφ(n): the number of integers k with 1≤k≤n and gcd(k,n)=1.

  • Divisor functionσk​(n)=∑d∣n​dk. In particular, σ0​(n)=d(n) counts the number of divisors and σ1​(n)=σ(n) gives the sum of divisors.

  • Möbius functionμ(n): equals 1 if n=1; equals (−1)k if n is a product of k distinct primes; equals 0 otherwise (i.e., if n has a squared prime factor).

Theorem 33 (Möbius inversion formula).
If F(n)=∑d∣n​f(d), then f(n)=∑d∣n​μ(n/d)F(d).
Definition 34 (Dirichlet convolution).
The Dirichlet convolution of two arithmetic functions f and g is defined by (f∗g)(n)=∑d∣n​f(d)g(n/d). The Dirichlet convolution of two multiplicative functions is again multiplicative.

Key algorithms:

  • Computingφ(n): from the prime factorization, φ(n)=n∏p∣n​(1−1/p) in O(n​) time.

  • Sieve-based batch computation: computes φ(k) and μ(k) for all k≤n in O(nloglogn) time.

For more details:

https://interconnectd.app/articles/2mHIeAkwmeJTGTXDnEuS

10. Continued Fractions and Diophantine Approximation

Definition 35 (Continued fraction expansion).
The (regular) continued fraction expansion of a real number α is a representation of the form
α=a0​+a1​+a2​+⋱1​1​1​=[a0​;a1​,a2​,…]
where a0​∈Z and ai​∈Z>0​ for i≥1. The expansion is finite if and only if α is rational.
Definition 36 (Convergents).
The rational number [a0​;a1​,…,an​]=pn​/qn​ is called the n-th convergent of α. The numerators and denominators satisfy the recurrence
pn​=an​pn−1​+pn−2​,qn​=an​qn−1​+qn−2​.
Theorem 37 (Best rational approximation).
The convergent pn​/qn​ is the best rational approximation to α among all fractions whose denominator does not exceed qn​.
Theorem 38 (Lagrange's theorem).
A real number α is a quadratic irrational if and only if its continued fraction expansion is eventually periodic.
Theorem 39 (Pell's equation).
If D is a positive integer that is not a perfect square, the positive integer solutions of x2−Dy2=1 can be obtained from the convergents of the continued fraction expansion of D​.

For more details:

https://interconnectd.app/articles/JcTNQc7t9vXwAR9kqyOP

11. The Distribution of Primes

Definition 40 (Prime-counting function).
π(x)=#{p≤x∣p is prime} is called the prime-counting function.
Theorem 41 (Prime number theorem).
π(x)∼lnxx​(x→∞)
That is, limx→∞​x/lnxπ(x)​=1.
Definition 42 (Chebyshev functions).
The Chebyshev functions are defined by θ(x)=∑p≤x​lnp and ψ(x)=∑pk≤x​lnp.
Theorem 43 (Chebyshev's theorem).
There exist positive constants c1​ and c2​ such that, for all sufficiently large x,
c1​lnxx​≤π(x)≤c2​lnxx​
Theorem 44 (Dirichlet's theorem on primes in arithmetic progressions).
If gcd(a,m)=1, then the arithmetic progression a,a+m,a+2m,… contains infinitely many primes.
Remark 45.
The Riemann hypothesis asserts that all nontrivial zeros of the Riemann zeta function ζ(s)=∑n=1∞​n−s lie on the critical line Re(s)=1/2. This remains one of the most important open problems in mathematics, intimately connected to the precise distribution of primes.

For more details:

https://interconnectd.app/articles/HIdN0m82xGJIRw6fKrx6

12. p-adic Valuations and Local Methods

Definition 46 (p-adic valuation).
For a prime p and a nonzero integer n, the p-adic valuationvp​(n) is the largest power of p dividing n. By convention, vp​(0)=+∞.
Definition 47 (p-adic absolute value).
The p-adic absolute value is defined by ∣n∣p​=p−vp​(n) for n=0, and ∣0∣p​=0.
Theorem 48 (Properties of thep-adic valuation).
  1. vp​(ab)=vp​(a)+vp​(b).

  2. vp​(a+b)≥min(vp​(a),vp​(b)) (corresponding to the ultrametric inequality).

  3. Equality condition: when vp​(a)=vp​(b), vp​(a+b)=min(vp​(a),vp​(b)).

Definition 49 (Ring ofp-adic integers and the field ofp-adic numbers).
The completion of Q with respect to the p-adic absolute value is the field ofp-adic numbersQp​. The subring Zp​={x∈Qp​∣∣x∣p​≤1} is the ring ofp-adic integers.
Theorem 50 (Hensel's lemma).
Let f(x)∈Zp​[x]. If f(a)≡0(modp) and f′(a)≡0(modp), then there exists α∈Zp​ with f(α)=0 and α≡a(modp).
Theorem 51 (Connection with the Legendre symbol).
For an odd prime p with gcd(a,p)=1, the congruence x2≡a(modp) has a solution if and only if x2=a has a solution in Qp​ (by lifting via Hensel's lemma).

For more details:

https://interconnectd.app/articles/ZA2dCEwFwQE9nq5a2lm6

13. Introduction to Algebraic Integers

Definition 52 (Algebraic integer).
An element α∈C is called an algebraic integer if it is a root of a monic polynomial with integer coefficients. The set of all algebraic integers forms a ring.
Definition 53 (Number field and ring of integers).
A finite extension K of Q is called a number field (or algebraic number field). The set of elements of K that are algebraic integers is denoted OK​ and called the ring of integers of K.
Example 54 (Quadratic fields).
For K=Q(d​), where d is a squarefree integer,
OK​={Z[d​]Z[21+d​​]​if d≡2,3(mod4)if d≡1(mod4)​
Definition 55 (Ideal).
An ideala of OK​ is an additive subgroup satisfying OK​⋅a⊆a.
Theorem 56 (Unique factorization of ideals).
Every nonzero ideal of OK​ factors uniquely (up to order) as a product of prime ideals:
a=p1e1​​p2e2​​⋯prer​​
This is a fundamental property of Dedekind domains.
Definition 57 (Class number).
The class numberhK​ is the order of the ideal class group Cl(OK​) (the group of equivalence classes of fractional ideals). We have hK​=1 if and only if OK​ is a unique factorization domain (UFD).
Theorem 58 (Minkowski's bound).
Every ideal class contains an ideal whose norm does not exceed the Minkowski bound:
MK​=nnn!​(π4​)r2​∣ΔK​∣​
where n=[K:Q], r2​ is the number of pairs of complex embeddings, and ΔK​ is the discriminant.

For more details:

https://interconnectd.app/articles/GBReud95ZKuEOOK2VgnD

14. Theorem and Algorithm Directory

A one-line summary of the major theorems and algorithms encountered in undergraduate number theory and competitive programming.

Fundamental theorems:

  1. Division algorithm: a=bq+r with 0≤r<b, uniquely determined.

  2. Fundamental theorem of arithmetic: every positive integer factors uniquely into primes.

  3. Bézout's identity: there exist integers x,y with gcd(a,b)=ax+by.

  4. Fermat's little theorem: p∤a⇒ap−1≡1(modp).

  5. Euler's theorem: gcd(a,m)=1⇒aφ(m)≡1(modm).

  6. Wilson's theorem: p is prime ⟺(p−1)!≡−1(modp).

  7. Chinese remainder theorem: a system of congruences with pairwise coprime moduli has a unique solution.

  8. Existence of primitive roots: primitive roots exist modulo m if and only if m=1,2,4,pk,2pk.

  9. Law of quadratic reciprocity: (qp​)(pq​)=(−1)2p−1​⋅2q−1​.

  10. Möbius inversion formula: F=f∗1⇒f=F∗μ.

  11. Prime number theorem: π(x)∼x/lnx.

  12. Dirichlet's theorem: if gcd(a,m)=1, then a+km is prime for infinitely many k.

Algebraic structure theorems:

  1. CRT ring isomorphism: Z/MZ≅∏Z/mi​Z.

  2. Hensel's lemma: a simple root modulo p lifts to a root in Zp​.

  3. Unique factorization of ideals: prime ideal factorization is unique in Dedekind domains.

  4. Lagrange's theorem (continued fractions): quadratic irrationals have eventually periodic continued fractions.

Key algorithms:

  • Euclidean algorithm (GCD): O(log(min(a,b)))

  • Extended Euclidean algorithm (GCD + Bézout coefficients): O(log(min(a,b)))

  • Sieve of Eratosthenes (prime enumeration): O(nloglogn)

  • Trial division (prime factorization): O(n​)

  • Miller–Rabin (primality testing): O(klog2n)

  • Repeated squaring (modular exponentiation): O(logn)

  • Constructive CRT: O(klogM)

  • Garner's algorithm (CRT): O(k2)

  • Baby-step giant-step (discrete logarithm): O(p​)

  • Tonelli–Shanks (square root modp): O(log2p)

  • Computing φ(n) (via prime factorization): O(n​)

Number TheoryAlgebraSummaryTheorem ReferenceAlgorithmsCompetitive Programming
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Number Theory TextbookPart 1 of 13
No previous article
Next
Divisibility and Congruences — Laying the Foundations of Number Theory

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Combinatorics: A Complete Summary of Definitions, Theorems, and Proofs

A single-page survey of undergraduate combinatorics. Covers the fundamentals of counting, binomial coefficients, inclusion-exclusion, generating functions, Catalan numbers, Ramsey theory, Burnside and Polya enumeration, combinatorial designs, posets, and algebraic combinatorics. Includes a dependency diagram and a theorem-algorithm directory.

CombinatoricsDiscrete MathematicsSummary
2
Folio Official·March 1, 2026

Continued Fractions and Diophantine Approximation — The Theory of Rational Approximation

We define finite and infinite continued fractions, prove convergence, and rigorously establish the properties of convergents. We develop the theory of best rational approximations, solve the Pell equation x^2 - Dy^2 = 1 via continued fractions, and discuss the Stern--Brocot tree.

Number TheoryAlgebraTextbook
3
Folio Official·March 1, 2026

Primes and the Fundamental Theorem of Arithmetic — The Atomic Decomposition of Integers

We define prime numbers and establish their basic properties, including Euclid's proof of the infinitude of primes. We then give a rigorous proof of the fundamental theorem of arithmetic (existence and uniqueness of prime factorization), and discuss the sieve of Eratosthenes and the Miller--Rabin primality test.

Number TheoryAlgebraTextbook
3
Folio Official·March 1, 2026

Introduction to Algebraic Integers — Extending the Notion of Integer

Using the Gaussian integers Z[i] and the Eisenstein integers Z[omega] as concrete examples, we introduce rings of algebraic integers. We demonstrate the failure of unique factorization in Z[sqrt(-5)] and show how ideals and prime ideal factorization restore uniqueness. We define the class number and discuss its significance.

Number TheoryAlgebraTextbook
2