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-10 of 13 results. Next

A122560 Primes p such that p^2 is a sum of three successive primes, or primes in A076304.

Original entry on oeis.org

7, 11, 29, 31, 43, 151, 157, 191, 263, 311, 359, 367, 563, 823, 859, 881, 929, 997, 1013, 1019, 1021, 1087, 1297, 1471, 1613, 1733, 1787, 1913, 2153, 2161, 2203, 2293, 2411, 2473, 2543, 2549, 2557, 2579, 2689, 2731, 2971, 3209, 3253, 3299, 3779, 3881, 3923
Offset: 1

Views

Author

Alexander Adamchuk, Sep 20 2006

Keywords

Comments

A076304(n) are the Numbers n such that n^2 is a sum of three successive primes.

Examples

			A076304(n) begins {7,11,29,31,43,151,157,191,209,217,...}.
So a(1) = 7 because A076304(1) = 7 is prime and 7^2 = 49 = 13 + 17 + 19 = p(6) + p(7) + p(8).
		

Crossrefs

Cf. A076304.

Programs

  • Mathematica
    Select[Table[Sqrt[Sum[Prime[k], {k, n, n + 2}]], {n, 400000}], PrimeQ] (* Ray Chandler, Sep 26 2006 *)
  • PARI
    has(n)=my(p=precprime(n\3), q=nextprime(n\3+1), r=n-p-q); if(r>q, r==nextprime(q+2), r==precprime(p-1) && r)
    list(lim)=my(v=List()); forprime(p=7,lim, if(has(p^2), listput(v,p))); Vec(v) \\ Charles R Greathouse IV, Jun 26 2019

Extensions

Extended by Ray Chandler, Sep 26 2006
Name edited by Zak Seidov, May 07 2014

A206279 Smallest of three consecutive primes whose sum is a square.

Original entry on oeis.org

13, 37, 277, 313, 613, 7591, 8209, 12157, 14557, 15679, 16267, 23053, 32233, 42953, 44887, 55213, 81013, 94687, 105649, 106397, 135241, 203317, 221401, 225769, 235747, 245941, 258707, 287671, 306541, 331333, 342049, 346111, 347443, 393853, 479191, 488827
Offset: 1

Views

Author

Harvey P. Dale, Feb 05 2012

Keywords

Examples

			a(4) = 313. The next two primes are 317 and 331, and 313 + 317 + 331 = 961 = 31^2.
		

Crossrefs

Programs

  • Mathematica
    Transpose[Select[Partition[Prime[Range[50000]],3,1],IntegerQ[ Sqrt[ Total[#]]]&]][[1]]
  • PARI
    p=2;q=3;forprime(r=5,1e9,if(issquare(p+q+r),print1(p", "));p=q;q=r) \\ Charles R Greathouse IV, Aug 28 2013

Formula

a(n) = A000040(A076305(n)). - Zak Seidov, Apr 07 2017

A076305 Numbers k such that prime(k) + prime(k+1) + prime(k+2) is a square.

Original entry on oeis.org

6, 12, 59, 65, 112, 965, 1029, 1455, 1706, 1830, 1890, 2573, 3457, 4490, 4664, 5609, 7927, 9130, 10078, 10143, 12597, 18248, 19727, 20086, 20887, 21708, 22739, 25041, 26536, 28511, 29346, 29664, 29774, 33387, 39945, 40677, 46136, 49869, 58135
Offset: 1

Views

Author

Zak Seidov, Oct 05 2002

Keywords

Comments

See A076304 for the square roots of the sums of the three primes.

Examples

			6 is a term because prime(6) + prime(7) + prime(8) = 13 + 17 + 19 = 49 = 7^2.
		

Crossrefs

Cf. A076304 (square roots of sums), A080665 (squares = sums), A206279 (lesser of the primes).
Cf. A064397 (same for 2 primes), A072849 (4 primes), A166255 (70 primes), A166261 (120 primes).

Programs

Formula

a(n) = A000720(A206279(n)). - M. F. Hasler, Jan 03 2020

Extensions

Corrected by Ray Chandler, Sep 26 2006

A226145 Numbers n such that triangular(n) is a sum of three successive primes.

Original entry on oeis.org

4, 5, 61, 82, 142, 166, 202, 233, 337, 394, 418, 422, 446, 493, 538, 661, 670, 841, 886, 1101, 1177, 1234, 1237, 1266, 1322, 1426, 1441, 1477, 1593, 1642, 1690, 1713, 1765, 1789, 1798, 1885, 1901, 1930, 1941, 2041, 2061, 2098, 2101, 2161, 2218, 2277, 2305, 2350, 2614
Offset: 1

Views

Author

Alex Ratushnyak, May 28 2013

Keywords

Examples

			For k = 5, triangular(k) = triangular(5) = 15. 15/3 = 5. The next prime larger or equal to 5 is 5. The prime before 5 is 3. If there is a triple of consecutive primes that sum to 15 then 3 and 5 are two of them. Then the third one must be 15 - 3 - 5 = 7. 7 is prime and 3, 5 and 7 are consecutive primes (as 7 is the next larger prime than 5 or the previous prime to 3). Therefore, k = 5 is in the sequence. - _David A. Corneth_, Sep 18 2019
		

Crossrefs

Cf. A167788 (the corresponding triangular numbers).

Programs

  • C
    #include 
    #include 
    #include 
    #define TOP (1ULL<<30)
    int main() {
      unsigned long long i, j, p1, p2, r, s;
      unsigned char *c = (unsigned char *)malloc(TOP/8);
      memset(c, 0, TOP/8);
      for (i=3; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
            for (j=i*i>>1; j>3] |= 1 << (j&7);
      for (p2=2, p1=3, i=5; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p2 + p1 + i;
          r = sqrt(s*2);
          if (r*(r+1)==s*2) printf("%llu, ", r);
          p2 = p1, p1 = i;
        }
      return 0;
    }
    
  • Mathematica
    (Sqrt[8#+1]-1)/2&/@Select[Total/@Partition[Prime[Range[ 100000]],3,1], OddQ[ Sqrt[8#+1]]&] (* Harvey P. Dale, Sep 18 2019 *)
  • PARI
    upto(n) = {my(res = List(), t = 10); for(i = 5, n, c = t/3; p = nextprime(ceil(c)); q = precprime(p - 1); r = t - p - q; if(isprime(r) && nextprime(r + 1) == q || nextprime(p + 1) == r, listput(res, i - 1)); t+=i); res}

A080665 Squares that are the sum of 3 consecutive primes.

Original entry on oeis.org

49, 121, 841, 961, 1849, 22801, 24649, 36481, 43681, 47089, 48841, 69169, 96721, 128881, 134689, 165649, 243049, 284089, 316969, 319225, 405769, 609961, 664225, 677329, 707281, 737881, 776161, 863041, 919681, 994009, 1026169, 1038361
Offset: 1

Views

Author

Cino Hilliard, Mar 02 2003

Keywords

Comments

Sum of reciprocals converges to 0.0317...

Examples

			13+17+19 = 49
		

Crossrefs

Cf. A062703.

Programs

  • Mathematica
    PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{m = Floor[n/3], t = 1}, If[PrimeQ[m], s = PrevPrim[m] + m + NextPrim[m], s = PrevPrim[ PrevPrim[m]] + PrevPrim[m] + NextPrim[m]; t = PrevPrim[m] + NextPrim[m] + NextPrim[ NextPrim[m]]]; If[s == n || t == n, True, False]]; Select[ Range[1020], f[ #^2] &]^2
  • PARI
    sump1p2p3sq(n)= {sr=0; forprime(x=2,n, y=x+nextprime(x+1)+nextprime(nextprime(x+1)+1); if(issquare(y),print1(y" "); sr+=1.0/y; ) ); print(); print(sr) }
    
  • PARI
    for(n=1,1e4,p=precprime(n^2/3);q=nextprime(p+1);t=n^2-p-q;if(isprime(t) && t==if(t>q,nextprime(q+1),precprime(p-1)), print1(n^2", "))) \\ Charles R Greathouse IV, May 26 2013

Formula

a(n) = A076304(n)^2. - Zak Seidov, May 26 2013

Extensions

Edited and extended by Robert G. Wilson v, Mar 02 2003
Offset corrected by Zak Seidov, May 26 2013

A226150 Smallest of three consecutive primes whose average is a triangular number.

Original entry on oeis.org

18713, 27253, 35227, 45433, 138587, 251677, 283861, 425489, 462221, 463189, 486583, 634493, 694409, 826211, 943231, 1103341, 1163557, 1181927, 1214453, 1282387, 1462891, 1509439, 1925681, 1931569, 2425487, 2970689, 3041803, 3324323, 3605939, 3627451, 4096933, 5140781
Offset: 1

Views

Author

Alex Ratushnyak, May 28 2013

Keywords

Crossrefs

Programs

  • C
    #include 
    #include 
    #include 
    #define TOP (1ULL<<30)
    int main() {
      unsigned long long i, j, p1, p2, r, s;
      unsigned char *c = (unsigned char *)malloc(TOP/8);
      memset(c, 0, TOP/8);
      for (i=3; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
            for (j=i*i>>1; j>3] |= 1 << (j&7);
      for (p2=2, p1=3, i=5; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p2 + p1 + i;
          if ((s%3)==0) {
            s/=3;
            r = sqrt(s*2);
            if (r*(r+1)==s*2) printf("%llu, ", p2);
          }
          p2 = p1, p1 = i;
        }
      return 0;
    }

A076306 Numbers k such that k^3 is a sum of three successive primes.

Original entry on oeis.org

11, 47, 145, 223, 229, 267, 313, 353, 365, 391, 397, 409, 507, 565, 567, 571, 573, 641, 661, 723, 793, 799, 841, 887, 895, 1015, 1051, 1089, 1293, 1297, 1411, 1451, 1469, 1789, 1909, 1943, 2043, 2077, 2171, 2401, 2459, 2497, 2671, 2801, 2851, 2871, 2921, 3211
Offset: 1

Views

Author

Zak Seidov, Oct 05 2002, Nov 12 2009

Keywords

Comments

prime(k) + prime(k+1) + prime(k+2) is a cube in A034961, k=A158796(n).

Examples

			11 is a term because 11^3 = 1331 = prime(85) + prime(86) + prime(87) = 439 + 443 + 449.
47 is a term because 47^3 = 103823 = prime(3696) + prime(3697) + prime(3698) = 34603 + 34607 + 34613.
		

Crossrefs

Programs

  • Mathematica
    okQ[n_]:=Module[{x=n^3,low,hi}, low=PrimePi[Round[x/3]]-4; hi=low+8; MemberQ[Total/@Partition[Prime[Range[low,hi]],3,1],x]]; Select[Range[5,3300],okQ]  (* Harvey P. Dale, Jan 27 2011 *)
  • PARI
    { p1=prime(1) ; p2=prime(2) ; p3=prime(3) ; n3=p1+p2+p3 ; for(i=1,100000000, if( ispower(n3,3,&n), print(n) ; ) ; n3 -= p1 ; p1=p2 ; p2=p3 ; p3=nextprime(p3+1) ; n3 += p3 ; ) ; } \\ R. J. Mathar, Jan 13 2007
    
  • PARI
    n=0; forstep(j=3, 86231, 2, c=j^3; c3=c/3; f=0; if(denominator(c3)==1, if(isprime(c3), if(precprime(c3-1)+c3+nextprime(c3+1)==c, f=1))); p2=precprime(c3); p1=precprime(p2-1); p3=nextprime(c3); p4=nextprime(p3+1); if(p1+p2+p3==c, f=1); if(p2+p3+p4==c, f=1); if(f==1, n++; write("b076306.txt", n " " j))) /* Donovan Johnson, Sep 02 2013 */
    
  • Python
    from _future_ import division
    from sympy import nextprime, prevprime, isprime
    A070306_list, i = [], 3
    while i < 10**6:
        n = i**3
        m = n//3
        pm, nm = prevprime(m), nextprime(m)
        k = n - pm - nm
        if isprime(m):
            if m == k:
                A070306_list.append(i)
        else:
            if nextprime(nm) == k or prevprime(pm) == k:
                A070306_list.append(i)
        i += 1 # Chai Wah Wu, May 30 2017

Extensions

More terms from R. J. Mathar, Jan 13 2007
a(29)-a(48) from Donovan Johnson, Apr 27 2008
Edited by N. J. A. Sloane, Nov 12 2009 at the suggestion of R. J. Mathar

A158796 Index of first of three successive primes which sum to a cube.

Original entry on oeis.org

85, 3696, 79700, 263166, 283353, 434935, 678277, 950264, 1043678, 1266169, 1321463, 1436753, 2629623, 3568796, 3604676, 3676738, 3713180, 5096401, 5558697, 7162624, 9303565, 9504536, 10988577, 12778681, 13108392, 18730119
Offset: 1

Views

Author

Zak Seidov, Nov 12 2009

Keywords

Examples

			a(1)=85 because prime(85)+prime(86)+prime(87)=439+443+449=11^3=(A076306(1))^3
a(2)=3696 because prime(3696)+prime(3697)+prime(3698)=34603+34607+34613=47^3=(A076306(2))^3.
		

Crossrefs

Programs

  • Maple
    count:= 0:
    for x from 3 while count < 30 do
      y:= x^3;
      r:= floor(y/3);
      p0:= prevprime(r); p1:= nextprime(p0); p2:= nextprime(p1);
      while p0 + p1 + p2 > y do
        p2:= p1;
        p1:= p0;
        p0:= prevprime(p0);
      od:
      while p0 + p1 + p2 < y do
        p0:= p1;
        p1:= p2;
        p2:= nextprime(p2);
      od:
      if p0 + p1 + p2 = y then
        count:= count+1;
        A[count]:= numtheory:-pi(p0);
      fi
    od:
    seq(A[i],i=1..count); # Robert Israel, Feb 10 2017
  • Python
    from _future_ import division
    from sympy import prevprime, nextprime, isprime, primepi
    A158796_list, i = [], 3
    while i < 10**6:
        n = i**3
        m = n//3
        pm, nm = prevprime(m), nextprime(m)
        k = n - pm - nm
        if isprime(m):
            if m == k:
                A158796_list.append(primepi(pm))
        else:
            if nextprime(nm) == k:
                A158796_list.append(primepi(pm))
            elif prevprime(pm) == k:
                A158796_list.append(primepi(pm)-1)
        i += 1 # Chai Wah Wu, Jun 01 2017

A226148 Smallest of three consecutive primes whose sum is a triangular number.

Original entry on oeis.org

2, 3, 619, 1123, 3373, 4603, 6829, 9067, 18973, 25933, 29179, 29741, 33211, 40583, 48313, 72923, 74923, 117991, 130973, 202201, 231067, 253993, 255217, 267317, 291491, 339139, 346309, 363829, 423191, 449621, 476279, 489337, 519487, 533713, 539093, 592507, 602603, 621133
Offset: 1

Views

Author

Alex Ratushnyak, May 28 2013

Keywords

Crossrefs

Cf. A167788 (the resulting triangular numbers).

Programs

  • C
    #include 
    #include 
    #include 
    #define TOP (1ULL<<30)
    int main() {
      unsigned long long i, j, p1, p2, r, s;
      unsigned char *c = (unsigned char *)malloc(TOP/8);
      memset(c, 0, TOP/8);
      for (i=3; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
            for (j=i*i>>1; j>3] |= 1 << (j&7);
      for (p2=2, p1=3, i=5; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p2 + p1 + i;
          r = sqrt(s*2);
          if (r*(r+1)==s*2) printf("%llu, ", p2);
          p2 = p1, p1 = i;
        }
      return 0;
    }
  • Maple
    R:= 2: count:= 1:
    for k from 1 while count < 100 do
     for j from 1 to 2 do
      m:= 4*k+j;
      x:= m*(m+1)/2;
      q= prevprime(ceil(x/3));
      p:= prevprime(q); r:= nextprime(q);
      t:= p+q+r;
      if t < x then while t < x do p:= q; q:= r; r:= nextprime(r); t:=p+q+r od
      elif t > x then while t > x do r:= q; q:= p; p:= prevprime(p); t:= p+q+r od
      fi;
      if t = x then  R:= R,p; count:= count+1; fi
    od od :
    R; # Robert Israel, Oct 18 2021

A226149 Smallest of three consecutive primes whose average is a square.

Original entry on oeis.org

2393, 25913, 47951, 123191, 131759, 219953, 330611, 356387, 450227, 769117, 826271, 870479, 1026143, 1500613, 1515347, 1697797, 1846861, 1907141, 2013541, 2217107, 2486873, 2732383, 3229189, 3294191, 3956101, 4338871, 4481677, 4739297, 5022067, 5239511, 5294591, 5774387
Offset: 1

Views

Author

Alex Ratushnyak, May 28 2013

Keywords

Crossrefs

Programs

  • C
    #include 
    #include 
    #include 
    #define TOP (1ULL<<30)
    int main() {
      unsigned long long i, j, p1, p2, r, s;
      unsigned char *c = (unsigned char *)malloc(TOP/8);
      memset(c, 0, TOP/8);
      for (i=3; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
            for (j=i*i>>1; j>3] |= 1 << (j&7);
      for (p2=2, p1=3, i=5; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p2 + p1 + i;
          if ((s%3)==0) {
            s/=3;
            r = sqrt(s);
            if (r*r==s) printf("%llu, ", p2);
          }
          p2 = p1, p1 = i;
        }
      return 0;
    }
  • Mathematica
    Select[Partition[Prime[Range[400000]],3,1],IntegerQ[Sqrt[Mean[#]]]&][[All,1]] (* Harvey P. Dale, Jan 10 2021 *)
Showing 1-10 of 13 results. Next