Gauss, in his 1849 letter to Encke, mentions that he noticed the primes have a density approx $\frac{1}{\ln(n)}$.

In that letter, he also mentions an integral function for approximating the prime counting function $\pi(n)$. His notation slightly unconventional, he wrote $\int \frac{{\rm d} n}{\log(n)}$, which today we consider the logarithmic integral approximation

$$\int^n_2\frac{1}{\ln(x)} {\rm d} x$$

If Gauss came up with the logarithmic integral approximation, who came up with the more discrete $\frac{n}{\ln(n)}$ ?

Today, it seems an obvious leap from the densities, but this is a question of maths history — who, when and how.


2 Answers 2


Gauss also came up with the more discrete $n/\ln (n)$- in volume 10 of his collected works appears a short (5-6 pages) fragment entitled "asymptotic laws of arithmetics", which is dated to the year 1791. In [1] of this fragment Gauss states this approximation of the primes counting function, as well as additional conjecture on the asymptotics of k-prime numbers. By examination of tables of prime numbers up to very large numbers, he stated the prime numbers theorem (that the average density of primes between $1$ and $n$ is $1/\log (n)$) as an empirical law, and on this basis derived his more general conjecture on k-prime numbers. Only later (it seems that in his 1849 letter to Encke) he refined his conjecture so that primes have a density $1/\log (n)$ "around" the number $n$, what leads directly to the (better) logarithmic integral approximation $\pi(n)\propto \int_{2}^{n}\frac{dx}{\ln x}$.

For an expanded discussion of the relation of Gauss's asymptotics for k-prime numbers to the prime numbers theorem, you might look at https://math.stackexchange.com/questions/2587733/what-was-the-heuristics-behind-gausss-guess-on-the-asymptotic-distribution-of-k .

As for online sources, Gauss's collected works can be read freely at the digital library of the goettingen university. Here is a link for Gauss's collected works: https://gdz.sub.uni-goettingen.de/id/PPN235957348. Specifically, what you are looking for (the prime numbers theorem) is in the begining of volume 10-1


With all due credit to Gauß, see the other answer, it seems to have been Adrien-Marie Legendre who first published this conjecturally. More precisely, on the last page of the introduction (p. 19) of the first edition of his Essai sur la théorie des nombres (1798), he says in a footnote:

Au reste, il est vraisemblable que la formule rigoureouse qui donne la valeur de $b$ [primes $\le a$] lorsque $a$ est tres-grand, est de la forme $b = \dfrac{a}{A \,log. a +B}$, $A$ et $B$ étant des coefficiens constans, et $log.a$ désignant un logarithme hyperbolique [i.e. $ln(a)$]. La détermination exacte de ces coefficiens seroit un problême curieux et digne d'exercer la sagacité des Analystes.

[My translation: "Besides, it is likely that the rigorous formula that gives the value of $b$ [primes $\le a$] when $a$ is very large, is of the form $b = \dfrac{a}{A \,log. a +B}$, where $A$ and $B$ are constant coefficients, and $log.a$ denotes a hyperbolic logarithm [i.e. $ln(a)$]. The exact determination of these coefficients is a curious problem, worthy for Analysts to exercise their sagacity."]

So in modern notation he conjectures that $\pi(x) \approx \dfrac{x}{A \ln(x) +B}$ with some constants $A, B$.

In the second edition of the same work (1808), he turned this into an entire section (§VIII) in the fourth part, starting on p. 394. He now claims that


is the best approximation, i.e. some time between 1798 and 1808 he made up his mind that of his constants, $A=1$, and $B\approx -1.08366$. In volume 2 of the extended third edition (1830), the last published in Legendre's life time, he sticks with this claim (fourth part, §VIII, p. 65).

The somewhat curious number $(\pm)1.08366$ has, somewhat unfairly, become known as Legendre's constant. According to the Wikipedia article, Chebyshev proved in 1849 that if the formula is valid for any $B$ at all, then the value must be $B=(-)1$, and according to the prime number theorem, it really is. So Legendre was actually right on his first account, just that one of his constants turned out to be much simpler than he thought.

It seems likely that Legendre came up with this independently from Gauß (if only because it seems Gauß conjectured the right constants rightaway).

It would actually be interesting to know where Legendre got his confidence from that those five decimals $.08366$ were right; because even though they are not that far off in the range for which prime number tables were available at that time, neither would have been some other numbers. Cf. https://www.mathpages.com/home/kmath032.htm. (E.g. sure, if we look at https://en.wikipedia.org/wiki/Legendre%27s_constant#/media/File:Legendre%27s_constant.svg, the blue line matches somewhat, but if we moved it up or down by $\pm 0.01$, it still would look reasonable; let alone going to $1.08361$ or $1.08379$ or ...) Likely there is something about that to be found in that §VIII of the fourth part of the later editions, which to be honest I did not read thoroughly now (and would lack understanding for anyway); maybe someone with better knowledge of number theory could help here.

  • $\begingroup$ thanks this is very helpful. What do you think of the reference to Gauss' 1791 publication referring to $\frac{a}{la}$? $\endgroup$
    – Penelope
    Jun 11, 2020 at 0:08
  • $\begingroup$ What do you mean, what do I think of it? I think Gauß was an amazing beyond-human being for coming up with that at age 14. But please note the other answer states quite clearly that it talks about a fragment found in Gauß' private notebooks, which was never published during his lifetime. Gauß' first publication at all was his Disquisitiones in 1801, which surpassed Legendre's Theorie des Nombres on many levels, but does not address distribution of primes; and I think Gauß never published his ideas about that at all, besides that letter to Encke. $\endgroup$ Jun 11, 2020 at 0:26
  • $\begingroup$ but isn't there evidence he wrote about it in 1791 even if he didn't publish it formally? $\endgroup$
    – Penelope
    Jun 11, 2020 at 4:27
  • $\begingroup$ Yes of course. I did not deny that, did I? $\endgroup$ Jun 11, 2020 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.