These volumes grew out of course notes for the course 304 Elementary Number Theory, which I taught at Johns Hopkins University in the Spring 2025 and Fall 2025 semesters. Since then, it has become a hobby to add new material to the notes, refine my typesetting, draw more figures, sharpen my writing, and find other ways to improve it, such as implementing LaTeX’s new tagging infrastructure to create accessible PDFs. The books are very much still a work in progress, with no anticipated official release or publication date. Please enjoy this beautiful subject!
Author: Egbert Rijke
Title: The Great Story of Numbers
Date: November 24, 2026
Level: Upper-division undergraduate
Language: English
Institution: Johns Hopkins University
Prerequisites: No prior knowledge required; This book is suitable for non-math majors
Accessibility
The standard versions use a tagged PDF setup with PDF 2.0 and MathML. This is the latest generation of accessibility standards for mathematical documents.
Some institutions, including my own, use the Ally accessibility checker in Canvas, which does not yet fully support these newer standards. For compatibility, I have provided separate Canvas editions that use PDF 1.7 and alternative text for mathematical expressions.
Improving the experience of this book with screen readers and other assistive technologies is very much on my mind, and an ongoing project.
Overview of the Course
Elementary Number Theory is a designated “Introduction to Proofs” course at the Johns Hopkins Mathematics Department. The course is taken by students with a variety of majors, including mathematics, computer science, chemistry, history, or music.
The beginning of the course focuses on proof writing, and covers topics such as induction, unique existence proofs, bijections, counting with bijections, and the well-ordering theorem. These topics are approached from three angles:
Skill development: The course gives concrete guidance on abstract reasoning, how to write a proof with clarity, and recognizing when a particular proof technique is appropriate.
History: By answering the question “How did mathematicians of the past think about certain phenomena?”, and “Have these concepts always been like that”, we make thinking about thinking about numbers more tangible.
Structural thinking: By articulating what kinds of structure we are thinking about, the student learns to extract the essence of a mathematical problem.
The course then develops topics such as divisibility, greatest common divisors, rational numbers, Pythagorean triples, and infinite descent. In the historical development, these lectures take us from ancient mathematics to the time of Fermat. The purpose here is to build a solid foundation in proof-writing skills, before moving on to the more typical number-theoretic topics. After this foundational part of the course, we cover topics such as modular arithmetic, the Chinese Remainder Theorem, primes, multiplicative functions, Fermat’s Little Theorem, Fermat’s Two-Squares theorem, polynomials, primitive roots, quadratic residues, and quadratic reciprocity.
The notes contain extensive references to historical aspects of number theory. I have made use of many sources to learn about the history of number theory, particularly Andre Weil’s Number Theory: An Approach Through History from Hammurapi to Legendre and Carl Friedrich Gauss’s Disquisitiones Arithmeticae. I have also read historical sources such as Fibonacci’s Liber Quadratorum, the works of Leonhard Euler, and I have benefitted from many online sources. In particular, the Internet Archive hosts scans of many original texts in number theory. Finally, I have learned from many textbooks in number theory, including LeVeque’s Topics in Number Theory, Hardy and Wright’s An Introduction to the Theory of Numbers, Silverman’s A Friendly Introduction to Number Theory, and many more. Furthermore, Keith Conrad’s various notes on topics in number theory have been invaluable.
Comments on the Pedagogy
Each chapter corresponds roughly to one lecture, although many chapters cover optional topics. At the end of each chapter, there is a set of exercises which are categorized along three tiers: starter exercises, routine-building exercises, and challenge exercises. The starter exercises are meant to test the student’s understanding of the central concept of a chapter, or their ability to make the essential computations with that concept. The routine-building exercises are designed to develop the student’s routine with a subject. A student might find them challenging at first, while they are still learning the subject, but they are designed so that most students attempting these will eventually find their solutions. These exercises are designed to bring the student to the intended level of skill for the course. The challenge exercises are designed to be harder, and require more creative solutions. Some of them are modified versions of contest problems. A weekly homework assignment consists typically of multiple routine-building exercises and one challenge problem.
For the pedagogical development of this course, I have made use of the textbook Teaching for Quality Learning at University by Biggs and Tang. While not specifically about mathematics education, this book offers valuable advice on how to foster a productive and inspiring learning environment for students.
Table of Contents
Introduction
The Nature of Numbers
The Nature of Mathematical Inquiry
Brief Remarks on the History of Number Theory
The Ancient Greek Scholars
Mathematics, Astronomy, and Poetry in Ancient India
Pierre de Fermat
Leonhard Euler
Johannes Carl Friedrich Gauss
Contemporary Mathematics
The Concept of Number Through History
Mathematical Language
Mathematical Induction
Recursion and Induction
Addition of Natural Numbers
Arithmetic of Natural Numbers
Relations on the Natural Numbers
Finite Sums and Products
Hemachandra’s Counting Problem
Exercises
Counting
Hume’s Principle
Equivalent Ways of Defining Bijections
Counting Bijections
Counting Subsets
The Binomial Theorem
The Inclusion–Exclusion Principle
The Stars-and-Bars Problem
Exercises
The Integers
Cyclic Sets
Maps Preserving Cyclic Structure
A Structural Definition of the Integers
Constructing the Integers from the Natural Numbers
Integer Arithmetic
Exercises
Notation for Numbers
Some Remarks on the History of Written Numbers
The Well-Ordering Principle of the Natural Numbers
Euclidean Division
The Representability Theorem
Combinatorial Applications
Exercises
Divisibility
The Condition of Divisibility
The Ordering by Divisibility
Ideals of Integers
Exercises
Linear Diophantine Equations
Greatest Common Divisors
Euclid’s Algorithm
Linear Diophantine Equations in Multiple Variables
Āryabhaṭa’s Computations of the Positions of Planets
Exercises
Congruences
The Congruence Relations
Equivalence Relations
Equivalence Classes and Residue Systems
Modular Arithmetic
The Multiplicative Order of an Integer Modulo n
Exercises
Systems of Linear Congruences
Solving Linear Congruences
Solving Multiple Linear Congruences Simultaneously
The Chinese Remainder Theorem
A Method Suggested by Gauss
Lifting Invertible Congruence Classes
Exercises
The Rational Numbers
Integer Fractions
The Irrationality of Square Roots
Continued Fractions
Farey’s Series of Fractions
A Structural Definition of the Rational Numbers
Exercises
Pythagorean Triples
The Pythagorean Theorem
Euclid’s Parametrization of the Pythagorean Triples
Rational Points on the Unit Circle
Vieta Jumping
The Tree of Primitive Pythagorean Triples
Squares in Arithmetic Progressions
Exercises
Infinite Descent
The Method of Infinite Descent
The Area of a Pythagorean Triangle is not a Square
The Unsolvability of x⁴ + y⁴ = z⁴
Aubry’s Theorem
The Nonexistence of Four Squares in an Arithmetic Progression
The Congruent Number Problem
Exercises
The Multiplicative Nature of Numbers
Prime Numbers
The Fundamental Theorem of Arithmetic
The Infinitude of Primes
Euclid’s Proof
Saidak’s Proof
Furstenberg’s Proof, Following Cass–Wildenberg
Erdős’s Proof
A Proof via the Stars-and-Bars Method
Fermat Primes
Legendre’s Formula and Kummer’s Theorem
Bertrand’s Postulate
Exercises
Multiplicative Functions
Perfect Numbers
Euler’s Totient Function
Multiplicative Functions
The Möbius Function
Dirichlet Convolution
Dirichlet Inverses
Exercises
Cyclic Counting
Hemachandra Wheels
The Prime–Fixed Point Congruence
Lucas’s Theorem
The Orbit–Counting Formula
The Divisor Sum of the Totient Function
Arithmetic Functions of Orbits and Fixed Points
Exercises
Fermat’s Little Theorem and its Consequences
Fermat’s Little Theorem
Euler’s Theorem
Wilson’s Theorem
Concerning Strong Divisibility Sequences
The Quadratic Character of -1
The Infinitude of Primes Congruent to 1 Modulo Powers of 2
Exercises
Fermat’s Two-Squares Theorem
Numbers Representable as a Sum of Two Squares
Euler’s Proof by Infinite Descent
Exercises
The Gaussian Integers
Definition and Basic Properties of the Gaussian Integers
Euclidean Division of Gaussian Integers
The Greatest Common Divisor of Gaussian Integers
Primes in the Gaussian Integers
Fermat’s Two-Square Theorem
The Biquadratic Character of -1
Exercises
Strong Divisibility Sequences
Lucas Sequences
The Rank of Apparition
Primitive Sequences
LCM-sequences
The Lifting the Exponent Lemma
Exercises
Polynomials
Polynomials with Abstract Coefficients
The Factor Theorem
Polynomial Congruences of Prime Moduli
Lagrange’s Interpolation Theorem
Fixed Divisors of Integer Polynomials
Exercises
Primitive Roots
Counting Elements of a Given Order Modulo a Prime
Primitive Roots
The Discrete Logarithm
A Criterion for Congruences of Degree n
Exercises
The Moduli with Primitive Roots
Primitive Roots Modulo Odd Prime Powers
The Complete Characterization of Moduli with Primitive Roots
Carmichael’s Function
Polynomial Congruences
Polynomial Congruences of Composite Moduli
Derivatives of Polynomials
Hensel’s Lemma
The Elementary Symmetric Polynomials
Reduced Polynomials Modulo a Prime
Divisibility and Irreducebility of Polynomials
Primitive Polynomials and Gauss’s Lemma
Euclid’s Algorithm for Polynomials
Irreducible Polynomials
Eisenstein’s Criterion
Exercises
Cyclotomic Polynomials
The Primitive Factors of xⁿ-1
The Möbius Inversion Formula for the Cyclotomic Polynomials
Irreducibility of the Cyclotomic Polynomials
Zsigmondy’s Theorem
The Infinitude of Primes Congruent to 1 Modulo n
Vantieghem’s Theorem
Exercises
Integer Factorizations of Polynomial Values
The Reducibility of xⁿ-a
Aurifeuillean Factorizations
Obstructions to the Infinitude of Primes in Lucas Sequences
The Arithmetic of Quadratic Forms
Quadratic Residues
Quadratic Congruences
Quadratic Residues
Legendre Symbols
Euler’s Criterion
Euler’s Prime-Generating Polynomial
Exercises
Quadratic Reciprocity
The Quadratic Character of 2
The Statement of Quadratic Reciprocity
Gauss’s Lemma
Eisenstein’s Proof
Exercises
Primality Testing
Pépin’s Primality Test for the Fermat Numbers
The Carmichael Numbers
The Lucas–Lehmer Primality Test
Pocklington’s Criteria
Mersenne Primes
Exercises
Conjectures in Elementary Number Theory
Conjectures About the Infinitude of Certain Classes of Primes
Conjectures About Exceptional Primes
Conjectures About Gaps Between the Primes
Conjectures About Conditions for Primality
Conjectures About Prime Decompositions
Conjectures About Arithmetic Functions
Conjectures About Diophantine Problems
Conjectures About Representations of Numbers
Conjectures About Iterative and Dynamical Processes