login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A333839
a(n) = Sum_{k = 4..n} ((prevprime(k) + nextprime(k))/2 - k).
0
0, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 3, 6, 8, 9, 9, 8, 6
OFFSET
4,5
COMMENTS
It looks like a(n) >= 0 for all n >= 4.
If (n,n+2) are twin primes, then a(n) = 0 and a(n+1) = 0.
Partial sums of b(k) = prevprime(k) + nextprime(k) - 2*k; b(k) = 0 for A145025.
FORMULA
a(n) = Sum_{k = 4..n} (A013632(k) - A049711(k)) / 2.
EXAMPLE
a(4) = (3 + 5)/2 - 4 = 0;
a(5) = (3 + 5)/2 - 4 + (3 + 7)/2 - 5 = 0.
MATHEMATICA
Array[Sum[Total[NextPrime[k, {-1, 1}]]/2 - k, {k, 4, #}] &, 92, 4] (* Michael De Vlieger, Apr 10 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Apr 07 2020
STATUS
approved