origin of analogy "primes as the atoms of number theory/ arithmetic" a math student recently challenged me on the old comparison/ analogy of prime numbers to "the atoms of number theory or arithmetic" and then was wondering the origin of the phrase.

where does this analogy of prime numbers to atoms originate, who was the 1st to use it?

for starters this page includes the quote by Sautoy from 1998 (M. du Sautoy, "The Music of the Primes", Science Spectra 11, 1998)

It remains unresolved but, if true, the Riemann Hypothesis will go to the heart of what makes so much of mathematics tick: the prime numbers. These indivisible numbers are the atoms of arithmetic.

am thinking that this analogy might be very old, say maybe decades or more, but could it predate even 21st century physics? also looking for other extended comparisons of the two beyond a mere passing sentence.
 A: For an ancient source regarding the "indivisibility" of prime numbers (but avoiding the term "atom"), see:


*

*Nicomachus of Gerasa (c.60 – c.120 CE), Introduction to Arithmetic (Arithmetike eisagoge), Engl.transl.(1926), page 202:



[Book 1, XI] the prime and incomposite [...] has received this name because it can be measured only by the number which is first and common to all, unity, and by no other. [...] To be sure, when they are combined with themselves, other numbers might be produced, originating from them as from a fountain and a root, wherefore they are called "prime", because they exist beforehand as the beginnings of the others. For every origin is elementary and incomposite, into which everything is resolved and out of which everything is made, but the origin itself cannot be resolved into anything or constituted out of anything.

See [Book 1, VII] for the definition of number:

Number [arithmos] is limited multitude or a combination of units [monadon] or a flow of quantity made up of units; and the first division of numbers is even and odd.

I'm not familiar with the Greek text; the word atomos is referenced, according to the Index, in 1,III,4, in the context of a quotation from Archytas, and 1,VIII,4-5, both with the meaning of "indivisible": the unit is indivisible.
We have to take into account the fact that the philosophical meaning of atom is "overloaded" with the atomist doctrine, while Nichomacus was a Neopythagorean. 
A: I add this as my contribution, just as a footnote of the answer and comments that were posted. My post isn't an answer for your question, just additional remarks that maybe are interesting in my view, thus you or the professors of this site MathOverflow feel free to comment if this isn't suitable as a contribution.
The online encyclopedia Wikipedia has an article for Primon gas.
About the atoms in physics I add as remark the well-known facts that 1) Georges Lemaître (see from the corresponding Wikipedia Georges Lemaître who was his doctoral advisor, and that he is known also in relation to the Hubble–Lemaître law from the Wikipedia Hubble's law) called to his theory with different words than Big Bang, the linked Wikipedia Georges Lemaître refers these as the last words in first paragraph of the article; and 2) the link nucleocosmogenesis in first paragraph of the Wikipedia George Gamow leads to the page of Wikipedia Nucleosynthesis (see the concise/introductory paragraph, that is the first paragraph, that refers the synthesis of first of those).
