In a previous article, I considered Mertens’ first theorem which states that:

\begin{equation} \sum_{p \leq N} \frac{\log p}{p} = \log N + \mathcal{O}(1) \end{equation}

This theorem has a beautiful corollary with the rather unassuming name of Mertens’ second theorem(1874):

\begin{equation} \sum_{p \leq N} \frac{1}{p} = \log\log N + \mathcal{O}(1) \end{equation}

While we may develop this result using Abel’s summation theorem, its natural interpretation was unveiled at a later date by the Hardy-Ramanujan theorem(1917) where (2) corresponds to the expected number of prime divisors of \(\sqrt{N}\).

Abel summation theorem:

Let’s suppose \(A(n)\) is a convergent series defined in terms of a continous function \(a(\cdot)\):

\begin{equation} A(n) = \sum_{c < r \leq n} a(r) = \int_{c}^n a(r)dr + \mathcal{O}(1) \end{equation}

If \(f\) is a function having a continuous derivative on \([y,x]\), then:

\begin{equation} \sum_{y < r \leq x} a(r) \cdot f(r) = A(x) \cdot f(x) - A(y) \cdot f(y) - \int_{y}^x A(t) \cdot f’(t) dt \end{equation}

which may be demonstrated using integration by parts.

Derivation of Mertens’ second theorem:

In order to apply Abel’s summation theorem, let’s first note that:

\begin{equation} \sum_{p \leq N} \frac{1}{p} = \sum_{p \leq N} \frac{\log p}{p} \cdot \frac{1}{\log p} \end{equation}

where \(A(N) = \sum_{2 \leq p \leq N} \frac{\log p}{p}\) and \(f(t) = \frac{1}{\log t}\).

Therefore, we have:

\begin{equation} \sum_{p \leq N} \frac{1}{p} = \sum_{p \leq N} \frac{\log p}{p} \cdot \frac{1}{\log p} = \frac{1}{\log N} \sum_{p \leq N} \frac{\log p}{p} + \int_{2}^N \sum_{p \leq t} \frac{\log p}{p} \cdot \frac{1}{t \cdot (\log t)^2} dt + \mathcal{O}(1) \end{equation}

and due to Mertens’ first theorem this simplifies to:

\begin{equation} \sum_{p \leq N} \frac{1}{p} = \int_{2}^N \frac{\log t}{t \cdot (\log t)^2} dt + \mathcal{O}(1) = \int_{2}^N \frac{1}{t \cdot \log t} dt + \mathcal{O}(1) = \log \log N + \mathcal{O}(1) \end{equation}



  1. Weisstein, Eric W. “Mertens’ Second Theorem.” From MathWorld–A Wolfram Web Resource.
  2. Hardy, G. H.; Ramanujan, S. (1917), “The normal number of prime factors of a number n”, Quarterly Journal of Mathematics