login
a(n) = Sum_{k=1..n} d(k)*prime(k), where d(k) = A001223.
1

%I #38 Jun 25 2022 01:05:41

%S 2,8,18,46,68,120,154,230,368,426,612,760,842,1014,1296,1614,1732,

%T 2098,2366,2508,2946,3262,3760,4472,4860,5062,5474,5688,6124,7706,

%U 8214,9000,9274,10664,10962,11868,12810,13462,14464,15502,15860,17670,18052

%N a(n) = Sum_{k=1..n} d(k)*prime(k), where d(k) = A001223.

%H Harry J. Smith, <a href="/A064009/b064009.txt">Table of n, a(n) for n=1..1000</a>

%e a(4) = 2*(3-2) + 3*(5-3) + 5*(7-5) + 7*(11-7) = 46.

%t Accumulate@ Array[# (NextPrime@ # - #) &@ Prime@ # &, {43}] (* _Michael De Vlieger_, May 05 2016 *)

%o (PARI) d(n) = prime(n+1)-prime(n); j=[]; for(n=1,150,j=concat(j,sum(k=1,n, prime(k)*d(k)))); j

%o (PARI) d(n)= { prime(n + 1) - prime(n) }

%o { a=0; for (n=1, 1000, write("b064009.txt", n, " ", a+=prime(n)*d(n)) ) } \\ _Harry J. Smith_, Sep 05 2009

%o (Sage) p=primes_first_n(44); d=differences(p); v=[]; a=0

%o for k in range(len(d)):

%o a+=p[k]*d[k]; v.append(a)

%o print(v) # _Giuseppe Coppoletta_, May 05 2016

%Y Cf. A001223.

%Y Partial sums of A291463.

%K nonn

%O 1,1

%A _Jason Earls_, Sep 06 2001