A024450 Sum of squares of the first n primes.
4, 13, 38, 87, 208, 377, 666, 1027, 1556, 2397, 3358, 4727, 6408, 8257, 10466, 13275, 16756, 20477, 24966, 30007, 35336, 41577, 48466, 56387, 65796, 75997, 86606, 98055, 109936, 122705, 138834, 155995, 174764, 194085, 216286, 239087, 263736, 290305, 318194
Offset: 1
Keywords
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..5000
- Carlos Rivera, Puzzle 128: Sum of consecutive squared primes a square, The Prime Puzzles & Problems Connection.
- Vladimir Shevelev, Asymptotics of sum of the first n primes with a remainder term
- Eric Weisstein's World of Mathematics, Prime Sums
- Eric Weisstein's World of Mathematics, Prime Zeta Function
- OEIS Wiki, Sums of powers of primes divisibility sequences
Crossrefs
Programs
-
Haskell
a024450 n = a024450_list !! (n-1) a024450_list = scanl1 (+) a001248_list -- Reinhard Zumkeller, Jun 08 2015
-
Magma
[&+[NthPrime(k)^2: k in [1..n]]: n in [1..40]]; // Vincenzo Librandi, Oct 11 2018
-
Magma
[n le 1 select 4 else Self(n-1) + NthPrime(n)^2: n in [1..80]]; // G. C. Greubel, Jan 30 2025
-
Maple
A024450:=n->add(ithprime(i)^2, i=1..n); seq(A024450(n), n=1..100); # Wesley Ivan Hurt, Nov 09 2013
-
Mathematica
Table[ Sum[ Prime[k]^2, {k, 1, n} ], {n, 40} ] Accumulate[Prime[Range[40]]^2] (* Harvey P. Dale, Apr 16 2013 *)
-
PARI
s=0;forprime(p=2,1e3,print1(s+=p^2", ")) \\ Charles R Greathouse IV, Jul 15 2011
-
PARI
a(n) = norml2(primes(n)); \\ Michel Marcus, Nov 26 2020
-
Python
from sympy import prime, primerange def a(n): return sum(p*p for p in primerange(1, prime(n)+1)) print([a(n) for n in range(1, 40)]) # Michael S. Branicky, Apr 13 2021
Formula
a(n) = Sum_{i=1..n} prime(i)^2. - Walter Kehowski, Jun 24 2006
a(n) = (1/3)*n^3*log(n)^2 + O(n^3*log(n)*log(log(n))). The proof is similar to proof for A007504(n) (see link of Shevelev). - Vladimir Shevelev, Aug 02 2013
a(n) = a(n-1) + prime(n)^2, with a(1) = 4. - G. C. Greubel, Jan 30 2025
Comments