login
Sum of first prime(n) primes.
2

%I #10 Jan 14 2019 14:44:48

%S 5,10,28,58,160,238,440,568,874,1480,1720,2584,3266,3638,4438,5830,

%T 7418,7982,9854,11240,11966,14288,15968,18650,22548,24680,25800,28104,

%U 29296,31734,41022,43940,48494

%N Sum of first prime(n) primes.

%H Robert Israel, <a href="/A022094/b022094.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A007504(A000040(n)). - _Robert Israel_, Jan 13 2019

%p [ seq(sum(ithprime(k),k=1..ithprime(i)),i=1..100) ];

%p # Alternative:

%p Primes:= select(isprime, [2,seq(i,i=3..10^4,2)]):

%p L:= ListTools:-PartialSums(Primes):

%p seq(L[Primes[i]],i=1..numtheory:-pi(nops(Primes))); # _Robert Israel_, Jan 13 2019

%t a[n_]:=Sum[Prime[k], {k,1,Prime[n]}]; Array[a, 50] (* _Stefano Spezia_, Jan 14 2019 *)

%Y Cf. A000040, A007504 (sum of first n primes).

%K easy,nonn

%O 1,1

%A Detlef Pauly (dettodet(AT)yahoo.de)