OFFSET
1,7
COMMENTS
From Bernard Schott, May 01 2021: (Start)
a(n) = 0 iff n is in A166081.
a(n) is odd iff n is A048974. (End)
FORMULA
a(n) = Sum_{i=1..floor(n/2)} c(i) * c(n-i) * (n-2*i), where c is the prime characteristic (A010051).
EXAMPLE
a(16) = 16; We have (3,13) and (5,11). The sum of the positive differences is (13-3) + (11-5) = 10 + 6 = 16.
MATHEMATICA
Table[Sum[(n - 2 i) (PrimePi[i] - PrimePi[i - 1]) (PrimePi[n - i] - PrimePi[n - i - 1]), {i, Floor[n/2]}], {n, 100}]
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Apr 29 2021
STATUS
approved