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.

Showing 1-4 of 4 results.

A024450 Sum of squares of the first n primes.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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

Crossrefs

Partial sums of A001248.
Cf. A007504 (sum of the first n primes).

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) = A007504(n)^2 - 2*A024447(n). - Alexander Adamchuk, Jun 15 2006
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

A081738 a(n) = Sum_{2 <= p <= n, p prime} p^2.

Original entry on oeis.org

0, 4, 13, 13, 38, 38, 87, 87, 87, 87, 208, 208, 377, 377, 377, 377, 666, 666, 1027, 1027, 1027, 1027, 1556, 1556, 1556, 1556, 1556, 1556, 2397, 2397, 3358, 3358, 3358, 3358, 3358, 3358, 4727, 4727, 4727, 4727, 6408, 6408, 8257, 8257, 8257, 8257, 10466, 10466
Offset: 1

Views

Author

N. J. A. Sloane, Apr 07 2003

Keywords

Crossrefs

Programs

  • Magma
    A081738:= func< n | n eq 1 select 0 else (&+[k^2: k in PrimesInInterval(1, n)]) >;
    [A081738(n): n in [1..60]]; // G. C. Greubel, Jan 31 2025
    
  • Mathematica
    Table[Total[Prime[Range[PrimePi[n]]]^2],{n,48}] (* Stefano Spezia, Aug 22 2022 *)
  • PARI
    a(n, j=2) = if(n <= 1, return(0)); my(r=sqrtint(n)); my(V=vector(r, k, n\k)); my(F(n,j)=(subst(bernpol(j+1),x,n+1) - subst(bernpol(j+1),x,1)) / (j+1)); my(L=n\r-1); V=concat(V, vector(L, k, L-k+1)); my(T=vector(#V, k, F(V[k],j))); my(S=Map(matrix(#V,2,x,y,if(y==1,V[x],T[x])))); forprime(p=2, r, my(sp=mapget(S,p-1), p2=p*p); for(k=1, #V, if(V[k] < p2, break); mapput(S, V[k], mapget(S,V[k]) - p^j*(mapget(S,V[k]\p) - sp)))); mapget(S,n)-1; \\ Daniel Suteu, Aug 21 2022
    
  • PARI
    a(n) = norml2(primes(primepi(n))); \\ Michel Marcus, Aug 22 2022
    
  • Python
    from sympy import prime, primerange
    def A081738(n): return sum(p**2 for p in primerange(2,n+1))
    print([A081738(n) for n in range(1,61)]) # G. C. Greubel, Jan 31 2025

A153022 Numbers n such that 1 plus the sum of squares of the first n primes is divisible by n+1.

Original entry on oeis.org

6, 10, 150, 238, 56824, 665460, 18468766, 193274008, 635705422, 790546908, 33256634229, 66874977806, 68066767730
Offset: 1

Views

Author

Ctibor O. Zizka, Dec 16 2008

Keywords

Comments

No further term <200000. [R. J. Mathar, Jan 17 2009]
a(11) > pi(10^11). [Donovan Johnson, Mar 10 2010]
a(14) > 118*10^9. - Robert Price, Apr 10 2013

Examples

			1 plus the sum of squares of the first 6 primes: (1 + 2^2 + 3^2 + ... + 13^2)/7 = 54, thus 6 is an element of the sequence.
		

Crossrefs

Formula

{n: n+1 | A024525(n) }. [R. J. Mathar, Jan 17 2009]

Extensions

a(5) from R. J. Mathar, Jan 17 2009
a(6)-a(10) from Donovan Johnson, Mar 10 2010
a(11)-a(13) from Robert Price, Apr 10 2013

A221867 Let m = A153022(n); a(n) = (1 + sum_{i=1..m} prime(i)^2)/(1+m).

Original entry on oeis.org

54, 218, 222054, 669806, 155593313228, 31860927184920, 37843679840313254, 5349233671440437948, 65075392901385088766, 102744428793110424984, 251471854505406311064463, 1074272348712875302655077, 1114427338015137279788981
Offset: 1

Views

Author

Robert Price, Apr 10 2013

Keywords

Examples

			For n=2, m=10, a(2) = 2398/11=218.
		

Crossrefs

Extensions

Definition corrected by N. J. A. Sloane, Apr 20 2013
Showing 1-4 of 4 results.