cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A139562 Sum of primes < n^2.

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Jun 11 2008

Keywords

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...

Examples

			For n = 3, n^2 = 9, the sum of primes <= 9 is 2+3+5+7 = 17 = a(3).
		

Crossrefs

First differences: A108314.

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