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.

A383504 Sum of next a(n) successive prime squares is prime.

Original entry on oeis.org

2, 5, 7, 25, 11, 13, 7, 7, 35, 7, 19, 31, 25, 11, 5, 19, 5, 11, 5, 139, 37, 17, 19, 19, 13, 5, 7, 7, 19, 13, 11, 5, 7, 11, 5, 5, 5, 13, 47, 43, 5, 23, 13, 11, 11, 79, 31, 35, 5, 5, 25, 5, 37, 95, 31, 13, 43, 17, 5, 35, 17, 23, 11, 41, 59, 7, 47, 5, 13, 7, 11
Offset: 1

Views

Author

Abhiram R Devesh, May 18 2025

Keywords

Comments

Group the primes such that the sum of squares of members of each group is a prime, and each successive group is as short as possible.
Apart from a(1)=2, a(n) is odd and not a multiple of 3.

Examples

			Primes, their squares, and the lengths of blocks which sum to a prime begin,
  primes  2, 3,  5,  7,  11,  13,  17,  19, ...
  squared 4, 9, 25, 49, 121, 169, 289, 361, ...
          \--/  \-------------------/  \--- ...
  sum      13            653
  a(n) =    2             5
		

Crossrefs

Cf. A001248, A073684 (sum of successive primes), A384161 (sum of successive prime cubes).

Programs

  • Maple
    i:= 0: p:= 0: t:= 0: count:= 0: R:= NULL:
    while count < 100 do
      p:= nextprime(p);
      i:= i+1;
      t:= t + p^2;
      if isprime(t) then
        R:= R, i; count:= count+1; i:= 0; t:= 0;
      fi
    od:
    R; # Robert Israel, May 25 2025
  • Mathematica
    p=1;s={};Do[c=0;sm=0;While[!PrimeQ[sm],sm=sm+Prime[p]^2;p++;c++];AppendTo[s,c],{n,71}];s (* James C. McMahon, Jun 09 2025 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        s, i, p = 0, 1, 2
        while True:
            while not(isprime(s:=s+p**2)): i, p = i+1, nextprime(p)
            yield i
            s, i, p = 0, 1, nextprime(p)
    print(list(islice(agen(), 71))) # Michael S. Branicky, May 23 2025