A139562 Sum of primes < n^2.
0, 0, 5, 17, 41, 100, 160, 328, 501, 791, 1060, 1593, 2127, 2914, 3831, 4661, 6081, 7982, 9523, 11599, 13887, 16840, 20059, 23592, 26940, 32353, 37561, 42468, 48494, 55837, 62797, 70241, 80189, 89672, 100838, 111587, 124211, 136114, 148827
Offset: 0
Keywords
Examples
For n = 3, n^2 = 9, the sum of primes <= 9 is 2+3+5+7 = 17 = a(3).
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
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 *)
-
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
Formula
a(n) = A034387(n^2) for n >= 1. - Alois P. Heinz, Jul 30 2021
Extensions
a(16) corrected by Michael S. Branicky, Jul 29 2021
Comments