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-5 of 5 results.

A071150 Primes p such that the sum of all odd primes <= p is also a prime.

Original entry on oeis.org

3, 29, 53, 61, 251, 263, 293, 317, 359, 383, 503, 641, 647, 787, 821, 827, 911, 1097, 1163, 1249, 1583, 1759, 1783, 1861, 1907, 2017, 2287, 2297, 2593, 2819, 2837, 2861, 3041, 3079, 3181, 3461, 3541, 3557, 3643, 3779, 4259, 4409, 4457, 4597, 4691, 4729, 4789
Offset: 1

Views

Author

Labos Elemer, May 13 2002

Keywords

Examples

			29 is a prime and 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 = 127 (also a prime), so 29 is a term. - _Jon E. Schoenfield_, Mar 29 2021
		

Crossrefs

Programs

  • Maple
    SoddP := proc(n)
        option remember;
        if n <= 2 then
            0;
        elif isprime(n) then
            procname(n-1)+n;
        else
            procname(n-1);
        fi ;
    end proc:
    isA071150 := proc(n)
        if isprime(n) and isprime(SoddP(n)) then
            true;
        else
            false;
        end if;
    end proc:
    n := 1 ;
    for i from 3 by 2 do
        if isA071150(i) then
            printf("%d %d\n",n,i) ;
            n := n+1 ;
        end if;
    end do: # R. J. Mathar, Feb 13 2015
  • Mathematica
    Function[s, Select[Array[Take[s, #] &, Length@ s], PrimeQ@ Total@ # &][[All, -1]]]@ Prime@ Range[2, 640] (* Michael De Vlieger, Jul 18 2017 *)
    Module[{nn=650,pr},pr=Prime[Range[2,nn]];Table[If[PrimeQ[Total[Take[ pr, n]]], pr[[n]],Nothing],{n,nn-1}]] (* Harvey P. Dale, May 12 2018 *)
  • Python
    from sympy import isprime, nextprime
    def aupto(limit):
      p, s, alst = 3, 3, []
      while p <= limit:
        if isprime(s): alst.append(p)
        p = nextprime(p)
        s += p
      return alst
    print(aupto(4789)) # Michael S. Branicky, Mar 29 2021

A007610 Sum of n consecutive primes starting at a(n) is prime (or 0 if impossible).

Original entry on oeis.org

2, 2, 5, 2, 5, 2, 17, 0, 3, 0, 5, 2, 29, 2, 3, 0, 3, 0, 11, 0, 7, 0, 7, 0, 5, 0, 7, 0, 13, 0, 13, 0, 7, 0, 5, 0, 5, 0, 13, 0, 7, 0, 7, 0, 7, 0, 7, 0, 11, 0, 17, 0, 3, 0, 3, 0, 97, 0, 29, 2, 3, 0, 13, 2, 3, 0, 19, 0, 19, 0, 3, 0, 5, 0, 3, 0, 23, 0, 7, 0, 11, 0, 53, 0, 31, 0, 89, 0, 53, 0, 19, 0, 11, 0, 3, 2
Offset: 1

Views

Author

Keywords

Comments

a(n) = 0 iff n is even and the sum of 2..P(n) is not prime. See A013916. - Robert G. Wilson v, Feb 16 2002

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • C. W. Trigg, Prime sums of consecutive primes, J. Rec. Math., 18 (No. 4, 1985-1986), 247-248.

Crossrefs

Programs

  • Mathematica
    f[n_] := If[OddQ@ n, Block[{k = 1}, While[ !PrimeQ[Plus @@ Prime[Range[k, k + n - 1]]], k++]; Prime@ k], If[ PrimeQ[Plus @@ Prime@ Range@ n], 2, 0]]; Array[f, 96] (* Robert G. Wilson v, May 11 2015 *)

A376891 Numbers k such that the sum of the first k lesser of twin primes is a lesser of twin prime.

Original entry on oeis.org

1, 23, 143, 251, 281, 305, 341, 455, 605, 761, 1349, 1613, 2765, 2903, 2981, 3623, 3725, 3923, 4049, 4133, 4745, 5207, 5303, 5489, 5765, 6515, 6611, 7793, 7835, 8153, 8237, 10427, 10697, 11261, 11447, 11627, 11729, 12401, 12701, 13871, 14327, 15359, 15683
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 08 2024

Keywords

Crossrefs

Programs

  • Maple
    K:= 1: count:= 1: s:= 3: k:= 1:
    for p from 5 by 6 do
      if isprime(p) and isprime(p+2) then
        k:= k+1;
        s:= s+p;
        if s mod 6 = 5 and isprime(s) and isprime(s+2) then
          count:= count+1; K:= K,k;
          if count = 100 then break fi;
    fi fi od:
    K; # Robert Israel, Oct 08 2024
  • Mathematica
    Position[Accumulate[Select[Partition[Prime[Range[200000]],2,1],#[[2]]-#[[1]]==2&][[;;,1]]],?(AllTrue[#+{0,2},PrimeQ]&)]//Quiet//Flatten (* _Harvey P. Dale, Jun 24 2025 *)
  • PARI
    lista(nn) = my(v=select(p->isprime(p+2), primes(nn)), s = vector(#v)); s[1] = v[1]; for (i=2, #v, s[i] = s[i-1]+v[i]); Vec(select(x->(isprime(x) && isprime(x+2)), s, 1)); \\ Michel Marcus, Oct 10 2024

A376892 Numbers k such that the sum of the first k greater of twin primes is a greater of twin prime.

Original entry on oeis.org

1, 45, 105, 675, 987, 1431, 1593, 1677, 1785, 1875, 2037, 2541, 3039, 3045, 3051, 3183, 3267, 3531, 3699, 4113, 4239, 4377, 4443, 5643, 5673, 5709, 6027, 6543, 6615, 6771, 6891, 6915, 6999, 8043, 8109, 8313, 8607, 8739, 10197, 10569, 11103, 11139, 11361, 11787, 12045
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 08 2024

Keywords

Crossrefs

Programs

  • Maple
    K:= 1: count:= 1: s:= 5: k:= 1:
    for p from 7 by 6 do
      if isprime(p) and isprime(p-2) then
        k:= k+1;
        s:= s+p;
        if s mod 6 = 1 and isprime(s) and isprime(s-2) then
          count:= count+1; K:= K, k;
          if count = 100 then break fi;
    fi fi od:
    K; # Robert Israel, Nov 08 2024
  • PARI
    lista(nn) = my(v=select(p->isprime(p-2), primes(nn)), s = vector(#v)); s[1] = v[1]; for (i=2, #v, s[i] = s[i-1]+v[i]); Vec(select(x->(isprime(x) && isprime(x-2)), s, 1)); \\ Michel Marcus, Oct 10 2024

A372041 Least prime p such that the sum of squares of the 2n + 1 consecutive primes starting with p is prime, or -1 if no such p exists.

Original entry on oeis.org

3, 3, 5, 3, 3, 5, -1, 5, 5, -1, 3, 7, -1, 3, 13, -1, 5, 5, -1, 7, 23, -1, 13, 5, -1, 7, 5, -1, 59, 29, 3, 3, 5, -1, 3, 5, -1, 13, 11, -1, 37, 23, -1, 43, 11, -1, 3, 5, -1, 11, 5, -1, 5, 19, -1, 5, 43, -1, 13, 29, -1, 7, 19, -1, 41, 47, -1, 13, 11, 3, 7, 5, -1, 29, 7, -1, 79, 13, 3, 3
Offset: 1

Views

Author

Michel Lagneau, Apr 17 2024

Keywords

Comments

a(n) = 2 never occurs, since the sum starting at 2 is always even and >= 4, so not prime.
a(n) = 3 iff n is in A370633 (and equivalently iff 2*n+1 is in A071149).
For n == 1 (mod 3), so 2*n+1 is a multiple of 3, a(n) = 3 or -1, since all primes >= 5 are congruent to 1 (mod 6) so the sum starting at 5 or more is a multiple of 3 and so not prime.

Examples

			a(6) = 5 because 5 is the smallest of 2*6+1 = 13 consecutive primes whose sum of squares = 5^2 + 7^2 + 11^2 + 13^2 + 17^2 + 19^2 + 23^2 + 29^2 + 31^2 + 37^2 + 41^2 + 43^2 + 47^2 = 10453 is prime.
a(7) = -1 because 7 == 1 (mod 3) so its only possibility is that the sum starts at 3, but 3^2 + ... + 53^2 = 13271 is not prime.
		

Crossrefs

Cf. A024450, A089793, A318351, A340771, A370633 (indices of 3's).

Programs

  • PARI
    a(n) = if ((n % 3) == 1, my(vp = primes(2*n+2)); if (isprime(sum(k=2, #vp, vp[k]^2)), return (3), return(-1));); my(vp = primes(2*n+2)); while(! isprime(sum(k=2, #vp, vp[k]^2)), vp = concat(setminus(vp, Set(vp[1])), nextprime(vp[2*n+2]+1))); vp[2]; \\ Michel Marcus, May 16 2024
Showing 1-5 of 5 results.