Øystein Ore, Number Theory and Its History (1948; reprinted with supplement, 1988), is a popular introduction to this fascinating subject and a timeless classic. More demanding mathematically is a book by a major figure in 20th-century mathematics, André Weil, Number Theory: An Approach through History from Hammurapi to Legendre (1984), which gives special attention to the work of Fermat and Euler. A dated but immense treatise is Leonard Eugene Dickson, History of the Theory of Numbers, 3 vol. (1919–23, reprinted 1999), which, though lacking material on 20th-century mathematics, provides a minutely detailed account of the development of number theory to that point. Morris Kline, Mathematical Thought from Ancient to Modern Times (1972, reissued in 3 vol., 1990), is an encyclopaedic survey of the history of mathematics—including many sections on the history of number theory. Two books by William Dunham, Journey Through Genius: The Great Theorems of Mathematics (1990) and The Mathematical Universe: An Alphabetical Journey Through the Great Proofs, Problems, and Personalities (1994), contain historically oriented chapters on number theory that are accessible to a wide audience. William Dunham, Euler: The Master of Us All (1999), recounts Euler’s work with perfect numbers and his tentative explorations into analytic number theory.
There are many number theory textbooks. One that adopts a historical viewpoint is David M. Burton, Elementary Number Theory, 4th ed. (1998). Gareth A. Jones and J. Mary Jones, Elementary Number Theory (1998), contains exercises with solutions and thus is suitable for self-instruction. On a somewhat higher level is Ivan Niven, Herbert S. Zuckerman, and Hugh L. Montgomery, An Introduction to the Theory of Numbers, 5th ed. (1991). M.R. Schroeder, Number Theory in Science and Communication: With Applications in Cryptography, Physics, Digital Information, Computing, and Self-Similarity, 3rd ed. (1997, reprinted with corrections, 1999), introduces nonmathematicians to applications of the subject.
Recreational aspects of number theory are presented in Albert H. Beiler, Recreations in the Theory of Numbers: The Queen of Mathematics Entertains, 2nd ed. (1966), and John H. Conway and Richard K. Guy, The Book of Numbers (1996, reprinted with corrections, 1998). Simon Singh, Fermat’s Enigma: The Epic Quest to Solve the World’s Greatest Mathematical Problem (1997), presents the historical development of modern number theory through the story of the solution of Fermat’s last theorem. Richard Friedberg, An Adventurer’s Guide to Number Theory (1968, reissued 1994), addresses topics of historical significance in a reader-friendly fashion.