# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a002815 Showing 1-1 of 1 %I A002815 M2523 N0996 #63 Feb 17 2024 08:17:32 %S A002815 0,1,3,6,9,13,17,22,27,32,37,43,49,56,63,70,77,85,93,102,111,120,129, %T A002815 139,149,159,169,179,189,200,211,223,235,247,259,271,283,296,309,322, %U A002815 335,349,363,378,393,408,423,439,455,471 %N A002815 a(n) = n + Sum_{k=1..n} pi(k), where pi() = A000720. %D A002815 H. Brocard, Reply to Query 1421, Nombres premiers dans une suite de différences, L'Intermédiaire des Mathématiciens, 7 (1900), 135-137. %D A002815 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence). %D A002815 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A002815 T. D. Noe, Table of n, a(n) for n = 0..1000 %F A002815 a(n) = A046992(n) + n for n > 0. - _Reinhard Zumkeller_, Feb 25 2012 %F A002815 Conjectured g.f.: (Sum_{N>=1} x^A008578(N))/(1-x)^2 = (x + x^2 + x^3 + x^5 + x^7 + x^11 + x^13 + ...)/(1-x)^2. - _L. Edson Jeffery_, Nov 25 2013 %t A002815 Table[n + Sum[PrimePi[k], {k, 1, n}], {n, 0, 50}] %t A002815 Module[{nn=50,pp},pp=Accumulate[PrimePi[Range[0,nn]]];Total/@ Thread[ {Range[ 0,nn],pp}]] (* This program is significantly faster than the program above. *) (* _Harvey P. Dale_, Jan 03 2013 *) %o A002815 (Haskell) %o A002815 a002815 0 = 0 %o A002815 a002815 n = a046992 n + toInteger n -- _Reinhard Zumkeller_, Feb 25 2012 %o A002815 (Python) %o A002815 from sympy import primerange %o A002815 def A002815(n): return n+(n+1)*len(p:=list(primerange(n+1)))-sum(p) # _Chai Wah Wu_, Jan 01 2024 %o A002815 (PARI) a(n) = my(p=primes([0,n])); n + (n+1)*#p - vecsum(p); \\ _Ruud H.G. van Tol_, Feb 16 2024 %Y A002815 Cf. A000720, A046992. %K A002815 nonn,nice,easy %O A002815 0,3 %A A002815 _N. J. A. Sloane_, _Robert G. Wilson v_, _Mira Bernstein_ # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE