A343782 Sum of the positive differences of the prime pairs (p,q) such that n = p + q and p <= q.
0, 0, 0, 0, 1, 0, 3, 2, 5, 4, 0, 2, 9, 8, 11, 16, 0, 12, 15, 20, 17, 28, 0, 26, 21, 32, 0, 24, 0, 28, 27, 32, 29, 64, 0, 60, 0, 24, 35, 58, 0, 72, 39, 86, 41, 88, 0, 122, 45, 116, 0, 78, 0, 128, 51, 98, 0, 108, 0, 144, 57, 80, 59, 202, 0, 204, 0, 60, 65, 184, 0, 216, 69, 188
Offset: 1
Keywords
Examples
a(16) = 16; We have (3,13) and (5,11). The sum of the positive differences is (13-3) + (11-5) = 10 + 6 = 16.
Programs
-
Mathematica
Table[Sum[(n - 2 i) (PrimePi[i] - PrimePi[i - 1]) (PrimePi[n - i] - PrimePi[n - i - 1]), {i, Floor[n/2]}], {n, 100}]
-
PARI
a(n) = my(s=0); forprime(p=1, n\2, if (isprime(n-p), s += n-2*p)); s; \\ Michel Marcus, May 01 2021
Formula
a(n) = Sum_{i=1..floor(n/2)} c(i) * c(n-i) * (n-2*i), where c is the prime characteristic (A010051).
Comments