Is the alternating sum of primes $2 - 3 + 5 + . . P_N$ asymptotic to $- N ln N/2$ for even $N$?

Given that many sums over the naturals (e.g., $1^2 + 2^ 2 + \ldots$) can be extended to sums over the primes using integration and the prime number theorem, it seems natural to look at sums that would be difficult to extend. The alternating sum $1 - 2 + 3 - 4 \ldots$ has an elementary sum; so consider the corresponding sum on the primes $2 - 3 + 5 - 7 + \ldots P_n$. For $n$ even, this is the negative of $(3- 2) + (7-5) + (13 - 11) + \ldots$ which is the negative of the sum of half the prime gaps between $2$ and $n$. But the sum of all the prime gaps telescopes to $P_n - 2$. Thus, heuristically a good estimate for the alternating sum appears to be $-P_n /2$ which by the prime number theorem is asymptotic to - $n \ln n/2$. Similarly, for odd $n$, a similar estimate is $-P_n/2 + P_n = n \ln n/2$. I coded up this estimate (actually, my code used the estimate due to Dusart of $P_n = n (\ln n + \ln \ln n - 1)$) and found errors less than 2% for $500 < n < 78, 401$ for both $n$ odd and $n$ even.

The question remains: is there a proof that the sum is asymptotic to $n \ln n /2$ for n odd and to $-n \ln n /2$ for $n$ even?

One of the comments refers to a limit by Ruiz http://www.primepuzzles.net/puzzles/puzz_211.htm. One of the posts there suggests that the Ruiz limit holds for prime powers as well. I have no idea whether the Ruiz result is proved (there seems to be some doubt) but the same heuristic argument above seems to extend to alternating series on prime powers $2^k - 3^k + 5^ k + ... P_n^k$. Again, for $n$ even this is the negative of the sum of the gaps $(3^k - 2^k) + (7^k - 5^k) + \ldots$ which is half of the sum of $(3^k - 2^k) + (5^k - 3^k) + (7^k - 5^k) + \ldots$ which telescopes to $P_n^k - 2^k$. This suggests heuristically again that a good estimate for the alternating sum to power $k$ is $- P_n^k/2$ for $n$ even and $P_n^k/2$ for $n$ odd. Or in terms of $n$, $-(n \ln n)^k/2$ for $n$ even and $(n \ln n)^k/2$ for $n$ odd. The OEIS has a page for $k = 1$ and some conjectures but not seemingly related to the sum. There does not seem to be an entry for $k = 2$ (the partial sums $4, -5, 20, -29, \ldots$)

• Another question that seems like it would be interesting to ask is about the 'balanced' version of this; $2-3+5-\ldots+\frac{(-1)^n}{2}P_n$ - or, essentially, removing the (almost-certain) first-order term from your estimate. It's unlikely that the result has any specific limiting behavior (for instance, I would be surprised if it doesn't alternate sign infinitely often), but it might be possible to talk about almost-everywhere bounds and/or smoothed behavior. – Steven Stadnicki May 1 '14 at 21:26
• Am I misunderstanding, or should the first alternating sum you mention be $1-2+3-4+\dots$ instead of $1-2+3-5+\dots$? – Federico Poloni May 1 '14 at 21:44
• The sequence of alternating sums is tabulated at oeis.org/A008347 where there are several conjectures and some links. – Gerry Myerson May 2 '14 at 2:36
• Regarding the generalization with $k\geq 2$: Using essentially the same techniques and that $p_{n+1}^{k+1}-p_n^{k+1}=(p_{n+1}-p_n)(p_{n+1}^k+\dots+p_n^k)=(p_{n+1}-p_n)((k+1)p_n^k + O_k(p_n^{k-1}))$, it would again be possible to prove a lower bound of the right order of magnitude for the alternating sum of $k$-th powers of primes. – rlo May 2 '14 at 16:20
• And, I guess, regarding Ruiz's purported proof: I haven't read it, but the discussion suggests that it's replacing $p_n$ by the asymptotic $p_n\sim n\log n$. This cannot work: there are many sequences which satisfy all the properties we know primes to have (e.g., the prime number theorem), and yet are such that, using the notation from my answer, $S(N;a,q)/p_N$ can tend to any value in $[0,1]$, or for which the limit doesn't exist, etc. To prove that $S(N;1,2) \sim p_N/2$, you have to rule out the possibility that all small prime gaps occur with odd index. But I have no idea how to do that! – rlo May 2 '14 at 16:24

As you remark, your quantity is governed by the sum of half of the prime gaps. More specifically, it's the (negative of the) sum of the odd index prime gaps. Let $$S(N;a,q) := \sum_{n\leq N, n\equiv a\pmod{q}} p_{n+1}-p_n.$$ The quantity you are interested in is therefore $-S(N;1,2)$. Is this surely asymptotic to $-p_N/2$? Yes. Can we prove it? I don't see how. However, it is possible to prove a lower bound. This was carried out by some students, Ping Ngai Chung and Shiyu Li, that I supervised last summer. You can view their work here: http://www.mathcs.emory.edu/~ono/REUs/archive/results/REU2013ChungLi.pdf.
They prove that $$\lim\inf_{N\to\infty} \frac{S(N;a,q)}{p_N} \geq \frac{1}{16q^2},$$ and, if we assume the Hardy-Littlewood 2-tuples conjecture, 16 can be replaced by 2. In particular, for $S(N;1,2)$, we get an unconditional lower bound of $p_N/64$ and a conditional lower bound of $p_N/8$. Their work also extends to any set of primes with positive density.
The basic idea of the proof is this. Using sieve techniques (in this case, Selberg's sieve, but many sieves will provide some result), it is possible to show that the number of prime gaps $p_{n+1}-p_n$ that lie in the interval $[0,\delta \log p_n]$ is a small proportion of all gaps, provided $\delta>0$ is not too big; let's call this proportion $\alpha$. If we're interested in providing a lower bound for $S(N;1,2)$, say, the worst that could happen is if all of these small gaps occurred at odd indices. But then, if $\alpha<1/2$, not all odd index gaps can be this small, and so $S(N;1,2)$ has to have some positive mass. To see the details of this idea carried out, I'll refer you to Chung and Li's paper.
I'll close by remarking that their motivating question was not to understand $S(N;a,q)$, but rather the (easily seen to be equivalent) question, how often is the prime counting function $\pi(x)$ even? How often is it $a\pmod{q}$?