login
A046992
a(n) = Sum_{k=1..n} pi(k) (cf. A000720).
30
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,3
COMMENTS
a(n) = A002815(n) - n. - Reinhard Zumkeller, Feb 25 2012
From Hieronymus Fischer, Sep 26 2012: (Start)
Let S(n) be a string of length n, then a(n) is the number of substrings of S(n) with a prime number of characters. Example 1: "abcd" is a string of length 4; there are a(4)=5 substrings with a prime number of characters (ab, bc, cd, abc and bcd). Example 2: "abcde" is a string of length 5; there are a(5)=8 substrings with a prime number of characters (ab, bc, cd, de, abc, bcd, cde and abcde).
Also: If n is represented in base 1 (this means 1=1_1, 2=11_1, 3=111_1, 4=1111_1, etc.), then a(n) is the number of substrings of n with a prime number of digits. Example: 7=1111111_1; the number of prime substrings of 7 (in base 1) is a(7)=15, since there are 15 substrings of prime length: 6 2-digit substrings, 5 3-digit substrings, 3 5-digit substrings and 1 7-digit substring.
(End)
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
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.
a(n) = (n+1)*A000720(n) - A034387(n).
(End)
a(n) ~ n^2 / (2 log n). - Charles R Greathouse IV, Mar 03 2017
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 *)
PROG
(Haskell)
a046992 n = a046992_list !! (n-1)
a046992_list = scanl1 (+) a000720_list
-- Reinhard Zumkeller, Feb 25 2012
(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
CROSSREFS
KEYWORD
nonn,easy,nice
EXTENSIONS
Corrected by Henry Bottomley
STATUS
approved