Calculate an upper bound for $\left|e^{\psi(N)}-\sum_{p_k\leq e^{\psi(N)}}(p_{k+1}-p_k)^2\right|$

Let $p_k$ the kth prime number, and $\Lambda(n)$ the von Mangoldt function. Thus $\psi(n)=\sum_{k\leq n}\Lambda(k)$ the second Chebyshev function. Also one can defines $g_n$ to be the gap between consecutive primes, this $g_n=p_{n+1}-p_n$, $n\geq 1$.

I would like to know if it is possible answer the following question. I know that I can do some calculations, using summation and asymptotic for prime numbers and the second Chebyshev function. Is not required the best calculations, only the ideas of how obtain a good statement.

Question. How one calculates a good upper bound for $$\left|e^{\psi(N)}-\sum_{p_k\leq e^{\psi(N)}}(p_{k+1}-p_k)^2\right|$$ unconditionally (without assumption of conjectures) for integers $N$ arbitrarily large (that is $N\to\infty$)? Many thanks.

As was said is not required the best statement, if is tis feasible combine with other technics or theorems about the distribution of prime numbers.

• I know asymptotic for $\sum_{p\leq x}p^2$ but perhaps were improved in the well known literature using prime gaps. I would like see in your answer, if it is possible, thus new notions, techniques and theorems. – user243301 Aug 12 '16 at 6:49

As usually, I write a possible bound but probably there is a way to do better. Let us define $$g_{k}=p_{k+1}-p_{k}.$$ It is well known , for a large $k,\, p_{k}>X$ say (and I think it is the best bound at the moment), that $$g_{k}\leq p_{k}^{\theta}$$ where $\theta=0.525$ (for a reference see Baker, R. C.; Harman, G.; Pintz, J. ($2001$). "The difference between consecutive primes, II". Proceedings of the London Mathematical Society. $83$ $(3)$: $532–562$). So we have that $$\sum_{X<p_{k}\leq x}g_{k}^{2}\leq\sum_{X<p_{k}\leq x}p_{k}^{2\theta}\leq\sum_{p_{k}\leq x}p_{k}^{2\theta}$$ so we have, by Abel's summation, that $$\sum_{p_{k}\leq x}p_{k}^{2\theta}=\pi\left(x\right)x^{2\theta}-2\theta\int_{2}^{x}\pi\left(t\right)t^{2\theta-1}dt$$ and now since exist some effectively computable constants $c_{1},\, c_{2}>0$ such that $$c_{1}\frac{n}{\log\left(n\right)}<\pi\left(n\right)<c_{2}\frac{n}{\log\left(n\right)},\, n>1$$ we can conclude that $$\sum_{p\leq x}p^{2\theta}\leq C\frac{x^{2\theta+1}}{\log\left(x\right)}$$ for an effectively computable $C>0$. About $\sum_{p_{k}\leq X}g_{k}^{2}$ we can use the Bertrand's postulate (which holds for every $p_{k}$) and get $$\sum_{p_{k}\leq X}g_{k}^{2}\leq\sum_{p_{k}\leq X}p_{k}^{2}\leq c_{3}X^{3}\log(X)$$ where $c_{3}>0$. Now since $x$ is arbitrary large we can assume that $$X\log^{1/3}(X)<\left(\frac{x^{2\theta+1}}{\log\left(x\right)}\right)^{1/3-\epsilon}$$ where $0<\epsilon<\frac{1}{3}$, so we have $$\sum_{p_{k}\leq X}g_{k}^{2}<\frac{x^{2\theta+1}}{\log\left(x\right)}$$ so finally
$$\left|x-\sum_{p_{k}\leq x}g_{k}^{2}\right|\leq x+\sum_{p_{k}\leq X}g_{k}^{2}+\sum_{X<p_{k}\leq x}g_{k}^{2}\leq\left(C+1\right)\frac{x^{2\theta+1}}{\log\left(x\right)}+x\ll\frac{x^{2\theta+1}}{\log\left(x\right)}$$
where $f\left(x\right)\ll g\left(x\right)$ means $f\left(x\right)=O\left(g\left(x\right)\right)$.
• Some questions: 1) how one knows (you) that need split the problem in $\sum_{p_{k}\leq X}$ and $\sum_{X<p_{k}\leq x}$? That is why do you know that is a good way use Bertrand for the first and Baker and Harman and Pintz for the second? 2) How one gets $\sum_{p_{k}\leq X}g_{k}^{2}\leq\sum_{p_{k}\leq X}p_{k}^{2}$ from Bertrand? I believe that the second is easy to answer, how do you calculate this inequality from Bertrnad? Thanks. – user243301 Aug 13 '16 at 11:19
• @user243301 1) The bound of BHP is better than Bertand but holds only for $x$ sufficiently large, so we have to split. The idea is to find a good asymptotic for large $x$ and use the trivial approximation for the other $x$. 2) From the Bertrand we know that exists a prime between $n$ and $2n$, so if we take $n=p_{k}$ we have that $p_{k+1} \leq 2p_{k}$, and so $g_{k} \leq p_{k}$. – Marco Cantarini Aug 13 '16 at 12:21