Number Theory: In Context and Interactive

Karl-Dieter Crisman's Number Theory: In Context and Interactive is a free textbook for an upper-level (US) number theory course, with a clear vision to expose students to the connections to all areas of mathematics. There are many exercises, both proof-based and computational, and nearly every concept can be visualized or experimented with using the open source mathematics software SageMath.

The book tackles all standard topics of modular arithmetic, congruences, and prime numbers, including quadratic reciprocity. In addition, there is significant coverage of various cryptographic issues, geometric connections, arithmetic functions, and basic analytic number theory, ending with a beginner's introduction to the Riemann Hypothesis. Ordinarily this should be enough material for a semester course with no prerequisites other than a proof-transition experience and vaguely remembering some calculus.

UPDATED EDITION AVAILABLE as of July 22nd, 2021, the July 2021, or 2021/7 Edition. Includes clarified licensing, new chapter summaries, and other fixes. This is a smaller update of the January 15th, 2021 (2021/1) edition, which added historical and combinatorial material, fixed many small typs, and had under-the-hood improvements. One known erratum. Same links!

The previous major edition was the January 2020, or 2020/1 Edition. This addressed the switch in the Sage cell server to using SageMath 9.0, which runs on Python 3. Most Sage commands should still work on older versions of Sage; see below for other editions.

The immediately preceding August 2019, or 2019/8 Edition, addressed all known typos/unclear relative pronouns, clarified many proofs, added much more cross-referencing and index entries, and fixed all known errata, though it introduced a couple new errata. Other than fixing Sage commands, this edition is identical to the one from 2020.

Those desiring access to the previous edition from January 2017 may find it here. See also the errata from the previous edition.