Many famous number-theorists have written about the history of the theory of numbers. One of the most prominent examples is that of **André Weil** (1906-1998): not only did he author [epoch-making][1] papers in mathematics, but he also wrote  "Number theory, an approach through history: from Hammurapi to Legendre". This book is, in my opinion, a very serious text on the historical side.

It seems to me that Weil was very interested in the history of the theory numbers throughout his life. According to Wikipedia, he wrote at least another book on the subject ("Essais historiques sur la théorie des nombres [1975]"); his interest in history is also manifest in his famous 1940 letter to his sister (cf. [A 1940 letter of André Weil on analogy in mathematics][2] [Notices of the Amer. Math. Soc. 52 (2005), no. 3,  pp. 335-341.]) and, if my memory serves right, he even offered (or used to offer) a course entitled "300 Years of Number Theory" at the IAS at some point in time.

**EDIT:** Since J. Stopple entered his answer as I was writing the above paragraphs, I am going to mention another famous mathematicians that wrote a very important opus on the history of the theory of numbers: **Leonard Eugene Dickson** (1874-1954). According to A. A. Albert, Dickson's three-volume work [*History of the Theory of Numbers*][3] would have been a life's achievement for itself for a more ordinary man...

  [1]: https://www.projecteuclid.org/euclid.bams/1183513798
  [2]: https://www.ams.org/notices/200503/fea-weil.pdf
  [3]: https://archive.org/details/historyoftheoryo01dick