OFFSET
1,2
LINKS
FORMULA
EXAMPLE
For n=7, 2n = 14 can be partitioned into two parts with the larger part prime as 13 + 1, 11 + 3, and 7 + 7. So a(7) = 1 + 3 + 7 = 11. - Michael B. Porter, Mar 14 2018
MAPLE
N:= 1000: # to get a(1)..a(n)
P:= select(isprime, [2, seq(i, i=3..2*N, 2)]):
S:= ListTools:-PartialSums(P):
f:= proc(n) local k1, k2;
k1:= numtheory:-pi(2*n);
k2:= numtheory:-pi(n-1);
2*n*(k1-k2) - S[k1] + S[k2]
end proc:
f(1):= 0:
seq(f(n), n=1..N); # Robert Israel, Mar 13 2018
MATHEMATICA
Table[Sum[i (PrimePi[2 n - i] - PrimePi[2 n - i - 1]), {i, n}], {n, 80}]
PROG
(PARI) a(n) = sum(k=1, n, k*isprime(2*n-k)); \\ Michel Marcus, Oct 24 2017
(PARI) a(n) = my(res = 0); forprime(p = n, 2*n, res+=(2*n - p)); res \\ David A. Corneth, Oct 24 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Oct 22 2017
STATUS
approved