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”).

Sum of primes <= n if 1 is counted as a prime.
6

%I #6 Feb 27 2017 17:30:32

%S 1,3,6,6,11,11,18,18,18,18,29,29,42,42,42,42,59,59,78,78,78,78,101,

%T 101,101,101,101,101,130,130,161,161,161,161,161,161,198,198,198,198,

%U 239,239,282,282,282,282,329,329,329,329,329,329

%N Sum of primes <= n if 1 is counted as a prime.

%C a(n) = A034387(n) + 1. a(p) - a(p-1) = p, for p = primes (A000040), a(c) - a(c-1) = 0, for c = composite numbers (A002808).

%H Harvey P. Dale, <a href="/A158662/b158662.txt">Table of n, a(n) for n = 1..1000</a>

%t Module[{nn=60,c},c=Join[{1},Prime[Range[PrimePi[nn]]]];Table[Total[ Select[ c,#<=n&]],{n,nn}]] (* _Harvey P. Dale_, Jun 01 2014 *)

%t Accumulate[Join[{1},Table[If[PrimeQ[n],n,0],{n,60}]]] (* _Harvey P. Dale_, Feb 27 2017 *)

%Y Cf. A034387, A000040, A002808.

%K nonn

%O 1,2

%A _Jaroslav Krizek_, Mar 23 2009, Apr 12 2009