The harmonic series, the "prime harmonic series", and their difference

Harmonic series

Consider the harmonic series 1+12+13+1 + \frac12 + \frac13 + \dots . Apparently, it was Donald Knuth who in 1968 (vol 1 of TAOCP, section 1.2.7 “Harmonic numbers”) gave the name “harmonic number” and the notation HnH_n to the partial sums of this series: Hn=1+12+13++1nH_n = 1 + \frac12 + \frac13 + \dots + \frac1n

It turns out that Hn=lnn+γ+12n112n2+1120n4+H_n = \ln{n} + \gamma + \frac{1}{2n} - \frac{1}{12n^2} + \frac{1}{120n^4} + \dots where the terms for powers k2k \ge 2 are Bkknk\dfrac{B_k}{k n^k} .

Prime harmonic series

What about adding only the reciprocals of the prime numbers, namely

p prime1p=12+13+15+17+111+113+117+\sum_{p\text{ prime}}\frac1p = \frac12 + \frac13 + \frac15 + \frac17 + \frac1{11} + \frac1{13} + \frac1{17} + \cdots

where we sum reciprocals of primes under some value xx ?

This too diverges, though very slowly: it follows from the second theorem of Mertens that

px1p=lnlnx+M+ϵ,\sum_{p\le x} \frac1p = \ln \ln x + M + \epsilon,

where MM is the Meissel–Mertens constant 0.26149721…. Here, for the error term ϵ\epsilon , Mertens proved that ϵ4ln(x+1)+2xlnx|\epsilon| \le \dfrac 4{\ln(x+1)} +\dfrac 2{x\ln x} ; this paper (see also this math.SE question and this MO question) shows that ϵ\epsilon changes sign infinitely often; and this 2016 paper by Pierre Dusart shows (its Theorem 5.6) that ϵ0.2ln3n|\epsilon| \le \dfrac{0.2}{\ln^3 n} for n2278383n \ge 2,278,383 .

The non-prime harmonic series

We can also take their difference, and consider

1+14+16+18+19+110+112+114+115+1 + \frac14 + \frac16 + \frac18 + \frac19 + \frac1{10} + \frac1{12} + \frac1{14} + \frac1{15} + \cdots

where we sum the reciprocals of non-prime integers under some value xx .

Being the difference of the two, this will grow like

lnxlnlnx+(γM)+O(1ln3n)\ln x - \ln \ln x + (\gamma - M) + O\left(\frac{1}{\ln^3 n}\right)

Further questions

Some of these questions are answered in this Colab notebook.