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

A226153 Numbers n such that triangular(n) is an average of 4 consecutive primes.

Original entry on oeis.org

5, 10, 14, 15, 22, 34, 49, 54, 64, 66, 81, 93, 104, 116, 121, 122, 146, 154, 156, 180, 194, 221, 222, 236, 270, 299, 320, 332, 334, 337, 346, 360, 369, 371, 374, 387, 416, 417, 429, 435, 444, 472, 492, 498, 511, 520, 551, 556, 617, 622, 637, 654, 657, 670, 674, 677, 680
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, p3, 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 (p3=2, p2=3, p1=5, i=7; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p3 + p2 + p1 + i;
          if (s%4==0) {
            s/=4;
            r = sqrt(s*2);
            if (r*(r+1)==s*2) printf("%llu, ", r);
          }
          p3 = p2, p2 = p1, p1 = i;
        }
      return 0;
    }
  • Maple
    A034963 := proc(n)
        add(ithprime(i), i=n..n+3) ;
    end proc:
    istriangular:=proc(n) local t1; t1:=floor(sqrt(2*n)); if n = t1*(t1+1)/2 then return t1 ; else return -1; end if; end;
    for n from 1 to 90000 do
        s := A034963(n)/4 ;
        if type(s,'integer') then
        tr := istriangular(s) ;
        if tr >= 0  then
            printf("%d, ", tr) ;
        end if;
        end if;
    end do: # R. J. Mathar, Jun 06 2013
  • Mathematica
    Module[{nn=30000,ntrs,m},ntrs=Table[{n,(n(n+1))/2},{n,nn}];m=Mean/@Partition[Prime[ Range[ nn]],4,1];Select[ntrs,MemberQ[m,#[[2]]]&]][[;;,1]] (* Harvey P. Dale, Jun 08 2023 *)
    (Sqrt[8#+1]-1)/2&/@Select[Mean/@Partition[Prime[Range[25000]],4,1],OddQ[Sqrt[8#+1]]&] (* Harvey P. Dale, Sep 17 2024 *)

A226154 Smallest of four consecutive primes whose sum is a triangular number.

Original entry on oeis.org

5, 23, 191, 389, 449, 2593, 3011, 5167, 5639, 5851, 8669, 18839, 25463, 26953, 28843, 38561, 47963, 51907, 57859, 65419, 67789, 77711, 78301, 79889, 96013, 102023, 128119, 139501, 163417, 192037, 206233, 234083, 273601, 299329, 324593, 354677, 359323, 362723, 417451
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, p3, 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 (p3=2, p2=3, p1=5, i=7; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p3 + p2 + p1 + i;
          r = sqrt(s*2);
          if (r*(r+1)==s*2) printf("%llu, ", p3);
          p3 = p2, p2 = p1, p1 = i;
        }
      return 0;
    }
  • Maple
    A000217inv:=proc(n) local t1; t1:=floor(sqrt(2*n)); if n = t1*(t1+1)/2 then return t1 ; else return -1; end if; end;
    isA226154 := proc(n)
        local p1,p2,p3,a034963 ;
        if isprime(n) then
            p1 := nextprime(n) ;
            p2 := nextprime(p1) ;
            p3 := nextprime(p2) ;
            a034963 := n+p1+p2+p3 ;
            if A000217inv(a034963) >= 0 then
                return true;
            else
                return false;
            end if;
        else
            false;
        end if;
    end proc:
    for n from 1 do
        p := ithprime(n) ;
        if isA226154(p) then
            printf("%d,\n",p) ;
        end if;
    end do: # R. J. Mathar, Jun 06 2013

A226155 Smallest of four consecutive primes whose average is a triangular number.

Original entry on oeis.org

11, 47, 101, 109, 241, 587, 1217, 1481, 2069, 2203, 3313, 4357, 5443, 6779, 7351, 7489, 10723, 11927, 12239, 16267, 18911, 24517, 24733, 27953, 36571, 44839, 51347, 55249, 55931, 56941, 60017, 64951, 68239, 68993, 70117, 75041, 86719, 87133, 92227, 94819, 98773, 111611
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, p3, 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 (p3=2, p2=3, p1=5, i=7; i < TOP; i+=2)
        if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
          s = p3 + p2 + p1 + i;
          if (s%4==0) {
            s/=4;
            r = sqrt(s*2);
            if (r*(r+1)==s*2) printf("%llu, ", p3);
          }
          p3 = p2, p2 = p1, p1 = i;
        }
      return 0;
    }
  • Maple
    A000217inv:=proc(n) local t1; t1:=floor(sqrt(2*n)); if n = t1*(t1+1)/2 then return t1 ; else return -1; end if; end;
    isA226155 := proc(n)
        local p1,p2,p3,a102655 ;
        if isprime(n) then
            p1 := nextprime(n) ;
            p2 := nextprime(p1) ;
            p3 := nextprime(p2) ;
            a102655 := (n+p1+p2+p3)/4 ;
            if type(a102655,'integer') then
                if A000217inv(a102655) >= 0 then
                    return true;
                else
                    return false;
                end if;
            else
                return false;
            end if;
        else
            false;
        end if;
    end proc:
    for n from 1 do
        p := ithprime(n) ;
        if isA226155(p) then
            printf("%d,\n",p) ;
        end if;
    end do: # R. J. Mathar, Jun 06 2013
Showing 1-3 of 3 results.