# Does the “alternating” harmonic series where only prime terms are negative converge?

We know that the harmonic series $\sum \frac{1}{n}$ diverges, yet the alternating harmonic series $\sum \frac{(-1)^n}{n}$ converges.

Euler famously gave a proof of the infinitude (and of the "density") of primes by showing that the series $\sum_p \frac{1}{p}$ diverges; this reasoning can be applied more generally to show Dirichlet's theorem on primes in arithmetic progression.

Can this reasoning lead to the stronger statement that $\sum \frac{\epsilon(n)}{n}$ converges, where $\epsilon(n)$ is $1$ if $n$ is prime and $-1$ otherwise? If this isn't true (which I suspect but can't easily prove), is there any relationship between whether an "alternating" harmonic series like this, where we give a $+$ sign to numbers in some set $S$ and a $-$ to others, converged and whether the sum of the harmonic series restricted to $S$ converges? Perhaps the case where $S$ is an arithmetic progression is easy?

What if we generalize further to partitions of the positive integers into $n$ parts and consider the harmonic sum where there's a different $n^{th}$ root of unity for each part? This feels like something related to Dirichlet zeta functions and characters of finite groups, but I don't know how to make this precise.

• If you had $\epsilon(n) = +1$ when $n$ is a multiple of three and $-1$ otherwise, this would diverge because the negative terms outgrow the positive ones. The same thing is true for your question, only the primes are so rare that not even 0.0001% of all terms will be positive (in the long run). This is kind of like hoping $\lim_{x\to\infty} x - e^x$ will exist just because $x$ and $e^x$ both diverge to infinity. – Erick Wong Aug 25 '15 at 5:20
• For a similar problem that actually has somewhat balanced behavior, try Liouville's function $-1$ to the power of the number of prime factors of $n$. This paper also discusses a root-of-unity analogue which you speculate near the end of your question. – Erick Wong Aug 25 '15 at 5:31
• If you want to quantify exactly how far away you got carried, you could read up on Mertens' second theorem... – Micah Aug 25 '15 at 5:34
• Wow, so I guess you could say the asymptotic behavior of $\sum \frac{1}{p}$ is as different from that of $\sum \frac{1}{n}$ as $\sum \frac{1}{n}$ is to $\sum 1$! (since the former is between $\log \log n$ and $\log n$ and the latter between $\log n$ and $n$) – Dorebell Aug 25 '15 at 5:48
• @Dorebell In fact it is sometimes said that $\sum 1/p$ diverges so slowly that $\sum 1/p$ over all known primes is less than $4$. There was a question on MSE that discussed the validity of this claim, but I can't seem to find it right now. – Erick Wong Aug 25 '15 at 6:21

We have two well-known asymptotics,

\begin{align} \sum_{n \leq N} \frac{1}{n} &\sim \log N \\ \sum_{p \leq N} \frac{1}{p} &\sim \log \log N. \end{align}

The difference in magnitude between these is so large that $$\sum_{n \leq X} \frac{\epsilon(n)}{n} \gg \log N$$ still, and so your sum still diverges.

More generally, you can hope for convergence if you choose $\epsilon(n)$ in such a way that the partial sums $$\sum_{n \leq N} \epsilon(n)$$ are uniformly bounded by some number $M$. This is the case in the regular harmonic series, as the partial sums are bounded by $1$. In the case of primes, the resulting partial sums diverge to infinity as "most" integers are not prime.

However, if the partial sums are uniformly bounded, then one can use Dirichlet's convergence test to show that the resulting pseudo-alternating harmonic series converges. This applies even if one chooses the weights to be roots of unity instead of $\pm 1$.