A046992 a(n) = Sum_{k=1..n} pi(k) (cf. A000720).
0, 1, 3, 5, 8, 11, 15, 19, 23, 27, 32, 37, 43, 49, 55, 61, 68, 75, 83, 91, 99, 107, 116, 125, 134, 143, 152, 161, 171, 181, 192, 203, 214, 225, 236, 247, 259, 271, 283, 295, 308, 321, 335, 349, 363, 377, 392, 407, 422, 437, 452, 467, 483, 499, 515, 531, 547, 563, 580, 597, 615, 633, 651, 669
Offset: 1
Links
- Hieronymus Fischer, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
Programs
-
Haskell
a046992 n = a046992_list !! (n-1) a046992_list = scanl1 (+) a000720_list -- Reinhard Zumkeller, Feb 25 2012
-
Mathematica
f[n_] := (f[n - 1] + PrimePi[n]); f[1] = 0; Table[ f[n], {n, 1, 60}] Accumulate[PrimePi[Range[70]]] (* Harvey P. Dale, Feb 27 2013 *)
-
PARI
a(n)=my(N=n+1,s); forprime(p=2,n, s+=N-p); s \\ Charles R Greathouse IV, Mar 03 2017
-
Python
from sympy import primerange def A046992(n): return (n+1)*len(p:=list(primerange(n+1)))-sum(p) # Chai Wah Wu, Jan 01 2024
Formula
O.g.f.: A(x)/(1-x)^2 where A(x) = Sum_{p=prime} x^p is the o.g.f. of A010051 and A(x)/(1-x) is the o.g.f. of A000720. - Geoffrey Critzer, Dec 04 2011
From Hieronymus Fischer, Sep 26 2012: (Start)
a(n) = Sum_{p<=n, p is prime} (n - p +1).
a(n) = (n+1)*pi(n) - Sum_pi(n), where pi(n) = number of primes <= n and Sum_pi(n) = sum of primes <= n.
(End)
a(n) ~ n^2 / (2 log n). - Charles R Greathouse IV, Mar 03 2017
Extensions
Corrected by Henry Bottomley
Comments