OFFSET
0,3
COMMENTS
This is also the sum of primes <= n^2.
Pi(x) is the prime counting function or the number of primes <= x.
SumP(n) is the sum of primes <= n.
SumP(n) ~ Pi(n^2).
For large n, a(n) is closely approximated by Pi(n^4). E.g., for n = 55, SumP(55^2) = 605877 and Pi(55^4) = 611827 with error = 0.0098...
For n = 10^5, SumP(10) = 2220822432581729238 and Pi(10^20) = 2220819602560918840 with error = 0.0000012...
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = A034387(n^2) for n >= 1. - Alois P. Heinz, Jul 30 2021
EXAMPLE
For n = 3, n^2 = 9, the sum of primes <= 9 is 2+3+5+7 = 17 = a(3).
MATHEMATICA
Array[Sum[p, {p, Prime@Range@PrimePi[#^2-1]}]&, 51, 0]
(* or *)
Table[Total@Select[Range[n^2-1], PrimeQ], {n, 0, 50}] (* Giorgos Kalogeropoulos, Jul 27 2021 *)
PROG
(PARI) a(n) = sum(k=1, n^2, k*isprime(k)); \\ Michel Marcus, Jul 27 2021
(Python)
from sympy import primerange
def a(n): return sum(p for p in primerange(1, n*n))
print([a(n) for n in range(39)]) # Michael S. Branicky, Jul 29 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Jun 11 2008
EXTENSIONS
a(16) corrected by Michael S. Branicky, Jul 29 2021
STATUS
approved