# A curious equality of integrals involving the prime counting function?

This post discusses the integral,
$$I(k)=∫k0π(x)π(k−x)dxI(k)=\int_0^k\pi(x)\pi(k-x)dx$$

where $$π(x)\pi(x)$$ is the prime-counting function. For example,
$$I(13)=∫130π(x)π(13−x)dx=73I(13)=\int_0^{13}\pi(x)\pi(13-x)dx = 73$$

Using WolframAlpha, the first 50 values for $$k=1,2,3,…k=1,2,3,\dots$$ are,

$$I(k)=0,0,0,0,1,4,8,14,22,32,45,58,73,90,110,132,158,184,214,246,282,320,363,406,455,506,562,618,678,738,804,872,944,1018,1099,1180,1269,1358,1450,1544,1644,1744,1852,1962,2078,2196,2321,2446,2581,2718,…I(k) = 0, 0, 0, 0, 1, 4, 8, 14, 22, 32, 45, 58, 73, 90, 110, 132, 158, 184, 214, 246, 282, 320, 363, 406, 455, 506, 562, 618, 678, 738, 804, 872, 944, 1018, 1099, 1180, 1269, 1358, 1450, 1544, 1644, 1744, 1852, 1962, 2078, 2196, 2321, 2446, 2581, 2718,\dots$$

While trying to find if the above sequence obeyed a pattern, I noticed a rather unexpected relationship:

Q: For all $$n>0n>0$$, is it true,
$$I(6n+4)−2I(6n+5)+I(6n+6)?=0I(6n+4) - 2\,I(6n+5) + I(6n+6) \overset{\color{red}?}= 0$$

Example, for $$n=1,2n=1,2$$, then
$$I(10)−2I(11)+I(12)=32−2∗45+58=0I(10)-2I(11)+I(12)=32-2*45+58 = 0$$
$$I(16)−2I(17)+I(18)=132−2∗158+184=0I(16)-2I(17)+I(18)=132-2*158+184= 0$$
and so on.

$$I(k)=∫k0∑p≤x∑q≤k−x1dx=∑p∑q≤k−p∫k−qpdx=∑p∑q≤k−p(k−(p+q))=∑m≤kr(m)(k−m), I(k) = \int_0^k \sum_{p\le x} \sum_{q\le k-x} 1 \,dx = \sum_p \sum_{q\le k-p} \int_p^{k-q} dx = \sum_p \sum_{q\le k-p} (k-(p+q)) = \sum_{m\le k} r(m)(k-m),$$
where $$r(m)r(m)$$ is the number of ways of writing $$mm$$ as the sum of two primes. Then
I(6n+6)−2I(6n+5)+I(6n+4)=∑m≤6n+4r(m)((6n+6−m)−2(6n+5−m)+(6m+4−m))+r(6n+5)=0+r(6n+5);\begin{align} I(6n+6) &{}-2I(6n+5)+I(6n+4) \\ &= \sum_{m \le 6n+4} r(m)\big((6n+6-m)-2(6n+5-m) +(6m+4-m)\big) + r(6n+5) \\&= 0 + r(6n+5); \end{align}
and $$r(6n+5)=0r(6n+5)=0$$ for every $$n≥1n\ge1$$, since the only way the odd integer $$6n+56n+5$$ can be the sum of two primes is $$6n+5=2+(6n+3)6n+5=2+(6n+3)$$, but $$6n+3=3(2n+1)6n+3=3(2n+1)$$ is always composite when $$n≥1n\ge1$$.
The same argument gives $$I(6n+2)−2I(6n+1)+I(6n)=r(6n+1)I(6n+2)-2I(6n+1)+I(6n) = r(6n+1)$$, which is $$22$$ if $$6n−16n-1$$ is prime and $$00$$ otherwise; this is why (as observed by John Omielan) it equals $$22$$ for $$1≤n≤51\le n\le 5$$ but $$00$$ for $$n=6n=6$$.