# Existence of relative Dirichlet density of primes starting with 1

This question is a duplicate of an existing MO question, but that other MO question has an accepted answer that does not actually answer the question, and I'm not sure how to fix that other than by re-asking the question.

On page 76 of Serre's book A Course in Arithmetic, he writes:

[T]here exist sets having an analytic density but no natural density. It is the case, for example, of the set $P^1$ of prime numbers whose first digit (in the decimal system, say) is equal to 1. One sees easily, using the prime number theorem, that $P^1$ does not have a natural density and on the other hand Bombieri has shown me a proof that the analytic density of $P^1$ exists (it is equal to $\log_{10}2 = 0.301029995\ldots$).

There is a slight misstatement here because literally speaking, $P^1$ has natural density zero, but clearly the intent is to speak of the relative density of $P^1$ inside the set $P$ of all primes. In other words, Bombieri's result is a kind of "Benford's law for primes": $$\lim_{s\to1} {\sum_{m\in P_1} m^{-s} \over \sum_{p\in P} p^{-s}} = \log_{10}2.$$

My question is, how does one prove that the above limit (which goes by various names—relative analytic density, relative Dirichlet density, relative zeta density) exists? Serre does not say anything about this.

The accepted answer to the duplicate MO question cites two papers, one by Cohen and Katz, and one by Raimi. But the paper by Cohen and Katz simply restates what Serre says without giving a proof. The paper by Raimi cites a paper by R. E. Whitney (Initial digits for the sequence of primes, Amer. Math. Monthly 79 (1972), 150–152) but Whitney's paper considers logarithmic density rather than Dirichlet density: $$\lim_{N\to\infty} {\sum_{m\in P_1, m\le N} 1/m \over \sum_{p\in P, p\le N} 1/p}.$$ It's not clear to me that this implies Bombieri's result.

In a comment to a now-deleted MO question, KConrad suggested looking in the book Prime Numbers by Ellison and Ellison, but I did not find the answer there either.

• It takes a certain amount of chutzpah to accuse Serre of making a misstatement. In number theory, it is extremely common to talk about the densities of various sets of primes relative to the set of all primes; this is the most common use of the word. The fact that the quote previously mentions the concepts of "analytic" density (which only makes sense for sets of prime numbers) makes it even clearer that this is the context in which Serre is working. You may as well say that "even numbers have density 1/2" is a misstatement because the set of even integers inside the reals has density zero. Aug 9, 2017 at 0:07
• @user113030 : You're right, Serre does actually define "natural density" in the preceding paragraph as relative density. My bad. Aug 9, 2017 at 0:33
• Look at Exercise 7.15 and 7.16 of the Ellison & Ellison book, including the hints. Apr 14, 2020 at 6:07
• @KConrad, is there any PDF of Ellisons' book? Nov 17, 2021 at 5:34
• @ShubhrajitBhattacharya I wrote up an argument below, so if you had not found a copy of the book by the Ellisons then there is no need to rely on it now. Apr 4, 2022 at 6:43

If a set of primes has a logarithmic density, then it also has a Dirichlet density, and the two agree --- and vice versa! For the direction you want (logarithmic -> Dirichlet), this follows by partial summation. Suppose $P$ is a set of primes with logarithmic density $\delta$, and let $S(t) = \sum_{p \le t,~p \in P} 1/p$. So by hypothesis, $S(t) = (\delta+o(1))\log\log{t}$, as $t\to\infty$. By partial summation, for any $s>1$, we have$$\sum_{p \in P} 1/p^s = (s-1) \int_{1}^{\infty} S(t) t^{-s}\, dt.$$

The key to the rest of the proof is that if we replace $S(t)$ with $\log\log t$ on the right-hand side, then the right-hand side is exactly $\log(\frac{1}{s-1}) - \gamma$. Starting from this, a little fooling around will show that our assumption on $S(t)$ implies that our right-hand side is $(\delta + o(1))\log\frac{1}{s-1}$ as $s\downarrow 1$. Since $\sum_{p} \frac{1}{p^s} = (1+o(1)) \log \frac{1}{s-1}$ as $s\downarrow 1$, we get the desired conclusion.

The other direction isn't relevant to this question, so I'll only quickly sketch it. If $P$ has Dirichlet density $\delta$, then letting $s=1+1/\log{x}$, one deduces that as $x\to\infty$, one has $\sum_{p\in P} \frac{1}{p^{1+1/\log{x}}} = (\delta+o(1)) \log\log x$. Using elementary estimates on the distribution of primes, one argues that $$\sum_{p \le x,~p\in P} \left(\frac{1}{p} - \frac{1}{p^{1+1/\log x}}\right) = o(\log \log x)$$ and that $$\sum_{p > x,~p \in P} \frac{1}{p^{1+1/\log x}} = o(\log\log x),$$ so that $\sum_{p \le x,~p \in P} 1/p = (\delta+o(1)) \log \log x$, as $x\to\infty$. (In fact, both of the displayed sums are $O(1)$, not merely $o(\log \log x)$.)

The answer by so-called friend Don indicates why the existence of logarithmic density implies the existence of Dirichlet density, with the same value. Below is an argument explaining why the set of primes with a specified initial digit has a logarithmic density (of Benford type), and thus a Dirichlet density. In my experience, the number of times authors cite Serre on this point is much greater than the number of references that provide an actual proof, so another write-up of a proof is probably helpful.

The paper by R. E. Whitney mentioned in the OP uses the Mertens formula $$\sum_{p \leq x} 1/p = \log \log x + M + O(1/(\log x)^2)$$, where the $$O$$-term is stronger than the remainder term typically found in treatments of this estimate, which is $$O(1/(\log x))$$. The argument below avoids this. We start with a useful technical lemma that will be applied a few times.

Lemma. For $$0 < c_1 < c_2$$ and $$b > 1$$, $$\sum_{c_1b^k \leq p \leq c_2b^k} \frac{1}{p} \sim \frac{\log_b(c_2/c_1)}{k}$$ as $$k \to \infty$$, where the sum on the left runs over primes.

Proof. Our argument is based on p. 7 here, which is the paper cited at the end of the Wikipedia page about Dirichlet density. That paper proves a much more general result than what we need.

Using partial summation, for $$x \geq 1$$ $$\sum_{p \leq x} \frac{1}{p} = \frac{\pi(x)}{x} + \int_1^x \frac{\pi(y)}{y^2}\,dy.$$ Therefore \begin{align*} \sum_{c_1b^k \leq p \leq c_2b^k} \frac{1}{p} & = \sum_{p \leq c_2b^k} \frac{1}{p} - \sum_{p \leq c_1b^k} \frac{1}{p} + O\left(\frac{1}{b^k}\right) \\ & = \frac{\pi(c_2b^k)}{c_2b^k} - \frac{\pi(c_1b^k)}{c_1b^k} + \int_{c_1b^k}^{c_2b^k} \frac{\pi(y)}{y^2}\,dy + O\left(\frac{1}{b^k}\right). \end{align*} To show this is asymptotic to $$\log_b(c_2/c_1)/k$$ as $$k \to \infty$$, we will show $$\frac{\pi(c_2b^k)}{c_2b^k} - \frac{\pi(c_1b^k)}{c_1b^k} = o\left(\frac{1}{k}\right), \ \ \ \int_{c_1b^k}^{c_2b^k} \frac{\pi(y)}{y^2}\,dy \sim \frac{\log_b(c_2/c_1)}{k}.$$

By the Prime Number Theorem, $$\pi(c_2b^k) \sim c_2b^k/\log(c_2b^k) \sim c_2b^k/(k\log b)$$ and $$\pi(c_1b^k) \sim c_1b^k/(k\log b)$$ as $$k \to \infty$$, so $$k\left(\frac{\pi(c_2b^k)}{c_2b^k} - \frac{\pi(c_1b^k)}{c_1b^k}\right) \to \frac{1}{\log b} - \frac{1}{\log b} = 0.$$ Thus $$\pi(c_2b^k)/c_2b^k - \pi(c_1b^k)/c_1b^k = o(1/k)$$ as $$k \to \infty$$.

To estimate $$\int_{c_1b^k}^{c_2b^k} (\pi(y)/y^2)\,dy$$, pick $$\varepsilon > 0$$. For large $$y$$, say $$y \geq y_\varepsilon$$, we have $$1-\varepsilon \leq \pi(y)/(y/\log y) \leq 1+\varepsilon$$, so $$(1-\varepsilon)/(y\log y) \leq \pi(y)/y^2 \leq (1+\varepsilon)/(y\log y)$$. For $$k$$ large enough that $$c_1b^k \geq y_\varepsilon$$, $$$$\label{int-long} (1-\varepsilon)\int_{c_1b^k}^{c_2b^k}\frac{dy}{y\log y} \leq \int_{c_1b^k}^{c_2b^k} \frac{\pi(y)}{y^2}\,dy \leq (1+\varepsilon)\int_{c_1b^k}^{c_2b^k}\frac{dy}{y\log y},$$$$ and as $$k \to \infty$$, \begin{align*} \int_{c_1b^k}^{c_2b^k}\frac{dy}{y\log y} = \log\log(c_2b^k) - \log\log(c_1b^k) & = \log\left(\frac{k\log b + \log c_2}{k\log b + \log c_1}\right) \\ & = \log\left(1 + \frac{\log_b(c_2/c_1)}{k + \log_b(c_1)}\right) \\ & = \frac{\log_b(c_2/c_1)}{k + \log_b(c_1)} + O\left(\frac{1}{k^2}\right) \\ & = \frac{\log_b(c_2/c_1)}{k} + O\left(\frac{1}{k^2}\right). \end{align*} Therefore $$1-\varepsilon \leq \varliminf_{k \to \infty} \frac{\int_{c_1b^k}^{c_2b^k} (\pi(y)/y^2)\,dy}{\log_b(c_2/c_1)/k} \leq \varlimsup_{k \to \infty} \frac{\int_{c_1b^k}^{c_2b^k} (\pi(y)/y^2)\,dy}{\log_b(c_2/c_1)/k} \leq 1 + \varepsilon.$$ Taking $$\varepsilon \to 0^+$$ shows $$\int_{c_1b^k}^{c_2b^k} (\pi(y)/y^2)\,dy \sim \log_b(c_2/c_1)/k$$, so we're done. QED

For $$d \in \{1, \ldots, 9\}$$, let $$A_d$$ be the set of primes with leading digit $$d$$. For example, \begin{align*} A_1 & = \{11, 13, 17, 19, 101, 103, 107, 109, 113, 127, 131, 137, 139, \ldots\}, \\ A_2 & = \{2, 23, 29, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, \ldots\}. \end{align*} We can describe the primes in $$A_d$$ in terms of inequalities: $$A_d = \{p : d \cdot 10^k \leq p < (d+1)10^k \ {\rm for \ some } \ k \geq 0\}.$$

Theorem. For each $$d$$, $$A_d$$ has logarithmic density $$\log_{10}((d+1)/d)$$.

Since existence of logarithmic density implies existence of Dirichlet density with the same value, $$A_d$$ has Dirichlet density $$\log_{10}((d+1)/d)$$.

Proof. Instead of estimating $$\frac{\sum_{p \in A_d, p \leq x} 1/p}{\log \log x}$$ for large $$x$$, we want to restrict $$x$$ to powers of $$10$$. We will first check the ratio changes negligibly when $$x$$ runs between consecutive powers of $$10$$. For $$n \geq 1$$, if $$10^n \leq x < 10^{n+1}$$ then $$\log n + \log \log 10 \leq \log\log x < \log(n+1) + \log \log 10,$$ so $$\log \log x \sim \log n$$ as $$x \to \infty$$. We will show
$$\frac{\sum_{p \in A_d, 10^n \leq p < 10^{n+1}} 1/p}{\log n} \to 0 \ {\rm as } \ n \to \infty,$$ so $$\lim_{x \to \infty} \frac{\sum_{p \in A_d, p \leq x} 1/p}{\log \log x} = \lim_{n \to \infty} \frac{\sum_{p \in A_d, p < 10^n} 1/p}{\log n},$$ in the sense that if the limit on the right exists then so does the limit on the left and they agree.

If $$d \not= 1$$ then $$\{p \in A_d : 10^n \leq p < 10^{n+1}\} = \emptyset$$.

If $$d = 1$$ then $$\{p \in A_d : 10^n \leq p < 10^{n+1}\} = \{p : 10^n \leq p \leq 2 \cdot 10^{n}\}$$ and $$\sum_{10^n \leq p \leq 2 \cdot 10^{n}} \frac{1}{p} \sim \frac{\log_{10} 2}{n}$$ by the lemma, so $$\frac{\sum_{p \in A_1, 10^n \leq p < 10^{n+1}} 1/p}{\log n} \sim \frac{\log_{10} 2}{n\log n} \to 0.$$

It remains to show $$\lim_{n \to \infty} \frac{\sum_{p \in A_d, p < 10^n} 1/p}{\log n} = \log_{10}\left(\frac{d+1}{d}\right).$$ Break up the numerator into sums between consecutive powers of $$10$$: $$\sum_{p \in A_d, p < 10^n} \frac{1}{p} = \sum_{0 \leq k \leq n-1} \left(\sum_{d \cdot 10^k \leq p < (d+1)10^k} \frac{1}{p}\right).$$ For $$k \geq 1$$, $$\sum_{d \cdot 10^k \leq p < (d+1)10^k} \frac{1}{p} = \sum_{d \cdot 10^k \leq p \leq (d+1)10^k} \frac{1}{p} \sim \frac{\log_{10}((d+1)/d)}{k}$$ by the lemma. Therefore $$\sum_{p \in A_d, p < 10^n} \frac{1}{p} \sim \sum_{1 \leq k \leq n-1} \frac{\log_{10}((d+1)/d)}{k} \sim \log_{10}\left(\frac{d+1}{d}\right)\log n,$$ so $$A_d$$ has logarithmic density $$\log_{10}((d+1)/d)$$. QED

Remark. In a similar way, if $$m \geq 2$$ and $$1 \leq a \leq m-1$$, then the set of primes whose number of digits (in base $$10$$, say) is congruent to $$a \bmod m$$ has logarithmic density $$1/m$$ (it has no natural density). For example, the set of primes with an odd number of digits has logarithmic density $$1/2$$.