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.

A024450 Sum of squares of the first n primes.

This page as a plain text file.
%I A024450 #71 Feb 16 2025 08:32:34
%S A024450 4,13,38,87,208,377,666,1027,1556,2397,3358,4727,6408,8257,10466,
%T A024450 13275,16756,20477,24966,30007,35336,41577,48466,56387,65796,75997,
%U A024450 86606,98055,109936,122705,138834,155995,174764,194085,216286,239087,263736,290305,318194
%N A024450 Sum of squares of the first n primes.
%C A024450 It appears that the only square in this sequence is 4. Checked 10^11 terms. a(10^11) = 247754953701579144582110673365391267. - _T. D. Noe_, Sep 06 2005
%C A024450 a(2n-1) is divisible by 2, a(3n+1) is divisible by 3, a(4n-3) is divisible by 4, a(6n+1) is divisible by 6, a(8n-3) is divisible by 8, a(12n+1) is divisible by 12, a(24n-11) is divisible by 24. - _Alexander Adamchuk_, Jun 15 2006
%C A024450 The sequence is best looked at in base 12, with X for 10 and E for 11: 4, 11, 32, 73, 154, 275, 476, 717, X98, 1479, 1E3X, 289E, 3860, 4941, 6082, 7823, 9844, EX25, 12546, 15447, 18548, 20089, 2406X, 2876E, 320E0, 37E91, 42152, 488E3, 53754, 5E015, 68416, 76337, 85178, 94399, X51EX, E643E, 108760, 120001. Since the squares of all primes greater than 3 are always 1 mod 12, the sequence obeys the rule a(n) mod 12 = (n-1) mod 12 for n>=2. The rule gives a(2n-1) = (2n-2) mod 12 and so a(2n-1) must be divisible by 2. a(3n+1) = (3n) mod 12 so a(3n+1) is divisible by 3. The other rules are proved similarly. Remember: base 12 is a research tool! - _Walter Kehowski_, Jun 24 2006
%C A024450 For all primes p > 3, we have p^2 == 1 (mod m) for m dividing 24 (and only these m). Using a covering argument, it is not hard to show that all terms except a(24k+13) are nonsquares. Hence in the search for square a(n), only 1 out of every 24 terms needs to be checked. - _T. D. Noe_, Jan 23 2008
%H A024450 N. J. A. Sloane, <a href="/A024450/b024450.txt">Table of n, a(n) for n = 1..5000</a>
%H A024450 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_128.htm">Puzzle 128: Sum of consecutive squared primes a square</a>, The Prime Puzzles & Problems Connection.
%H A024450 Vladimir Shevelev, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2013-August/011512.html">Asymptotics of sum of the first n primes with a remainder term</a>
%H A024450 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeSums.html">Prime Sums</a>
%H A024450 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeZetaFunction.html">Prime Zeta Function</a>
%H A024450 OEIS Wiki, <a href="https://oeis.org/wiki/Sums_of_primes_divisibility_sequences">Sums of powers of primes divisibility sequences</a>
%F A024450 a(n) = A007504(n)^2 - 2*A024447(n). - _Alexander Adamchuk_, Jun 15 2006
%F A024450 a(n) = Sum_{i=1..n} prime(i)^2. - _Walter Kehowski_, Jun 24 2006
%F A024450 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
%F A024450 a(n) = a(n-1) + prime(n)^2, with a(1) = 4. - _G. C. Greubel_, Jan 30 2025
%p A024450 A024450:=n->add(ithprime(i)^2, i=1..n); seq(A024450(n), n=1..100); # _Wesley Ivan Hurt_, Nov 09 2013
%t A024450 Table[ Sum[ Prime[k]^2, {k, 1, n} ], {n, 40} ]
%t A024450 Accumulate[Prime[Range[40]]^2] (* _Harvey P. Dale_, Apr 16 2013 *)
%o A024450 (PARI) s=0;forprime(p=2,1e3,print1(s+=p^2", ")) \\ _Charles R Greathouse IV_, Jul 15 2011
%o A024450 (PARI) a(n) = norml2(primes(n)); \\ _Michel Marcus_, Nov 26 2020
%o A024450 (Haskell)
%o A024450 a024450 n = a024450_list !! (n-1)
%o A024450 a024450_list = scanl1 (+) a001248_list
%o A024450 -- _Reinhard Zumkeller_, Jun 08 2015
%o A024450 (Magma) [&+[NthPrime(k)^2: k in [1..n]]: n in [1..40]]; // _Vincenzo Librandi_, Oct 11 2018
%o A024450 (Magma) [n le 1 select 4 else Self(n-1) + NthPrime(n)^2: n in [1..80]]; // _G. C. Greubel_, Jan 30 2025
%o A024450 (Python)
%o A024450 from sympy import prime, primerange
%o A024450 def a(n): return sum(p*p for p in primerange(1, prime(n)+1))
%o A024450 print([a(n) for n in range(1, 40)]) # _Michael S. Branicky_, Apr 13 2021
%Y A024450 Partial sums of A001248.
%Y A024450 Cf. A024447, A024525, A098561, A098562.
%Y A024450 Cf. A007504 (sum of the first n primes).
%K A024450 nonn
%O A024450 1,1
%A A024450 _Clark Kimberling_