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.

Previous Showing 31-40 of 47 results. Next

A226151 Numbers n such that triangular(n) is a sum of 4 consecutive primes.

Original entry on oeis.org

8, 15, 39, 56, 60, 144, 155, 203, 212, 216, 263, 388, 451, 464, 480, 555, 619, 644, 680, 723, 736, 788, 791, 799, 876, 903, 1012, 1056, 1143, 1239, 1284, 1368, 1479, 1547, 1611, 1684, 1695, 1703, 1827, 1859, 1908, 1939, 2100, 2108, 2135, 2148, 2152, 2187, 2199, 2216
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, ", r);
          p3 = p2, p2 = p1, p1 = i;
        }
      return 0;
    }
  • Maple
    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;
    A034963 := proc(n)
        add(ithprime(i),i=n..n+3) ;
    end proc:
    for n from 1 to 90000 do
        ist := istriangular(A034963(n)) ;
        if ist >= 0 then
            printf("%d,",ist) ;
        end if;
    end do: # R. J. Mathar, Jun 04 2013
  • Mathematica
    (Sqrt[8#+1]-1)/2&/@Select[Total/@Partition[Prime[Range[ 60000]],4,1], OddQ[ Sqrt[8#+1]]&] (* Harvey P. Dale, Apr 06 2016 *)

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

A127492 Indices m of primes such that Sum_{k=0..2, k

Original entry on oeis.org

2, 10, 17, 49, 71, 72, 75, 145, 161, 167, 170, 184, 244, 250, 257, 266, 267, 282, 286, 301, 307, 325, 343, 391, 405, 429, 450, 537, 556, 561, 584, 685, 710, 743, 790, 835, 861, 904, 928, 953
Offset: 1

Views

Author

Artur Jasinski, Jan 16 2007

Keywords

Comments

Let p_0 .. p_4 be five consecutive primes, starting with the m-th prime. The index m is in the sequence if the absolute value [x^0] of the polynomial (x-p_0)*[(x-p_1)*(x-p_2) + (x-p_2)*(x-p_3) + (x-p_3)*(x-p_4)] + (x-p_1)*[(x-p_2)*(x-p_3) + (x-p_3)*(x-p_4)] + (x-p_2)*(x-p_3)*(x-p_4) is two times a prime. The correspondence with A127491: the coefficient [x^2] of the polynomial (x-p_0)*(x-p_1)*..*(x-p_4) is the sum of 10 products of a set of 3 out of the 5 primes. Here the sum is restricted to the 6 products where the two largest of the 3 primes are consecutive. - R. J. Mathar, Apr 23 2023

Crossrefs

Programs

  • Maple
    isA127492 := proc(k)
        local x,j ;
        (x-ithprime(k))* mul( x-ithprime(k+j),j=1..2)
        +(x-ithprime(k))* mul( x-ithprime(k+j),j=2..3)
        +(x-ithprime(k))* mul( x-ithprime(k+j),j=3..4)
        +(x-ithprime(k+1))* mul( x-ithprime(k+j),j=2..3)
        +(x-ithprime(k+1))* mul( x-ithprime(k+j),j=3..4)
        +(x-ithprime(k+2))* mul( x-ithprime(k+j),j=3..4) ;
        p := abs(coeff(expand(%/2),x,0)) ;
        if type(p,'integer') then
            isprime(p) ;
        else
            false ;
        end if ;
    end proc:
    for k from 1 to 900 do
        if isA127492(k) then
            printf("%a,",k) ;
        end if ;
    end do: # R. J. Mathar, Apr 23 2023
  • Mathematica
    a = {}; Do[If[PrimeQ[(Prime[x] Prime[x + 1]Prime[x + 2] + Prime[x] Prime[x + 2]Prime[x + 3] + Prime[x] Prime[x + 3] Prime[x + 4] + Prime[x + 1] Prime[x + 2]Prime[x + 3] + Prime[x + 1] Prime[x + 3]Prime[x + 4] + Prime[x + 2] Prime[x + 3] Prime[x + 4])/2], AppendTo[a, x]], {x, 1, 1000}]; a
    prQ[{a_,b_,c_,d_,e_}]:=PrimeQ[(a b c+a c d+a d e+b c d+b d e+c d e)/2]; PrimePi/@Select[ Partition[ Prime[Range[1000]],5,1],prQ][[;;,1]] (* Harvey P. Dale, Apr 21 2023 *)

Extensions

Definition simplified by R. J. Mathar, Apr 23 2023
Edited by Jon E. Schoenfield, Jul 23 2023

A131686 Sum of squares of five consecutive primes.

Original entry on oeis.org

208, 373, 653, 989, 1469, 2189, 2981, 4061, 5381, 6701, 8069, 9917, 12029, 14069, 16709, 19541, 22061, 24821, 27989, 31421, 35789, 40661, 45029, 49589, 53549, 56909, 62837, 69389, 76709, 84149, 93581, 100253, 107741, 115541, 124109, 131837
Offset: 1

Views

Author

Artur Jasinski, Sep 14 2007

Keywords

Examples

			a(1)=208 because 2^2+3^2+5^2+7^2+11^2=208
		

Crossrefs

Programs

  • Mathematica
    a = 2; Table[Prime[n]^a + Prime[n + 1]^a + Prime[n + 2]^a + Prime[n + 3]^a + Prime[n + 4]^a, {n, 1, 100}]

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

A226196 Triangular numbers which are an average of four consecutive primes.

Original entry on oeis.org

15, 55, 105, 120, 253, 595, 1225, 1485, 2080, 2211, 3321, 4371, 5460, 6786, 7381, 7503, 10731, 11935, 12246, 16290, 18915, 24531, 24753, 27966, 36585, 44850, 51360, 55278, 55945, 56953, 60031, 64980, 68265, 69006, 70125, 75078, 86736, 87153, 92235, 94830, 98790, 111628
Offset: 1

Views

Author

Alex Ratushnyak, May 30 2013

Keywords

Crossrefs

Programs

  • 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 proc:
    for n from 1 to 90000 do
        s := A034963(n)/4 ;
        if type(s, 'integer') then
            tr := A000217inv(s) ;
            if tr >= 0  then
                printf("%d, ", s) ;
            end if;
        end if;
    end do: # R. J. Mathar, Jun 06 2013
  • Mathematica
    Select[Mean/@Partition[Prime[Range[20000]],4,1],OddQ[Sqrt[8#+1]]&] (* Harvey P. Dale, Dec 18 2015 *)

Formula

a(n) = A000217(A226153(n)).

A283873 Smallest number that is the sum of n successive primes and also the sum of n successive semiprimes, n > 1.

Original entry on oeis.org

24, 749, 48, 311, 690, 251, 2706, 2773, 6504, 1081, 2162, 1753, 11356, 6223, 1392, 2303, 9838, 637, 14510, 1995, 3154, 21459, 72960, 5691, 8140, 1475, 2350, 3647, 1593, 7607, 55074, 2719, 9852, 12143, 106562, 12615, 9036, 19883, 15438, 28369, 8560, 8415, 3831
Offset: 2

Views

Author

Zak Seidov, Mar 17 2017

Keywords

Comments

The sequence is non-monotone.

Examples

			a(2) = 24 = A000040(5) + A000040(6) = 11 + 13 = A001358(4) + A001358(5) = 10 + 14,
a(3) = 749 = A000040(53) + A000040(54) + A000040(55) = 241 + 251 + 257 = A001358(79) + A001358(80) + A001358(81) = 247 + 249 + 253.
		

Crossrefs

Cf. A000040 Primes, A001358 Semiprimes, A118717 Sum of two consecutive semiprimes.
Sum of k consecutive primes: A001043 k=2, A034961 k=3, A034963 k=4, A034964 k=5, A127333 k=6, A127334 k=7, A127335 k=8, A127336 k=9, A127337 k=10, A127338 k=11, A127339 k=12.

Programs

  • Maple
    issp:= n-> is(not isprime(n) and numtheory[bigomega](n)=2):
    ithsp:= proc(n) option remember; local k; for k from 1+
            `if`(n=1, 1, ithsp(n-1)) while not issp(k) do od; k
            end:
    ps:= proc(i, j) option remember;
           ithprime(j)+`if`(i=j, 0, ps(i, j-1))
         end:
    ss:= proc(i, j) option remember;
           ithsp(j)+`if`(i=j, 0, ss(i, j-1))
         end:
    a:= proc(n) option remember; local i, j, k, l, p, s;
          i, j, k, l, p, s:= 1, n, 1, n, ps(1, n), ss(1, n);
          do if p=s then return p
           elif pAlois P. Heinz, Mar 24 2017
  • Mathematica
    sp=Select[Range[4,100000],2==PrimeOmega[#]&];pr=Prime[Range[PrimePi[Max[sp]]]];
    Table[Intersection[(Total/@Partition[pr,k,1]),Total/@Partition[sp,k,1]][[1]],{k,2,100}]

Extensions

More terms from Alois P. Heinz, Mar 24 2017

A359199 Least prime p such that 2n can be written as a signed sum of p and the next 3 primes, or -1 if no such prime exists.

Original entry on oeis.org

5, 3, 3, 3, 7, 3, 3, 5, 3, 19, 3, 5, 79, 3, 113, 17, 467, 7, 5, 11, 19, 17, 19, 13, 7, 17, 1123, 17, 19, 23, 11, 23, 19, 31, 2153, 31, 13, 23, 29, 31, 29, 37, 43, 37, 17, 31, 19081, 37, 43, 41, 19319, 19, 37897, 53, 43, 54193, 35671, 47, 43, 53, 23, 53, 59, 47, 35603, 61
Offset: 0

Author

Karl-Heinz Hofmann and Peter Munn, Jun 04 2023

Keywords

Comments

We require each of the 4 primes to appear in the sum exactly once.
Inspired by the study of problems about the signed sum of consecutive primes, for example, by Rivera in 2000 (see link).
The equivalent sequence with 2 rather than 4 primes is A363544, which is closely related to A000230, which concerns prime gaps.
Conjecture: a satisfactory prime p exists for all n.
The magnitude of the terms exhibits a notable variation that depends on the number of negations in the sum. See the visualization in the links.
All odd primes appear in the sequence. When 2n = A034963(k) we see the last occurrence of the k-th prime. Obviously, these last occurrences correspond to the sums where all the signs are positive. Do any odd primes occur only once?

Examples

			The signed sums of 2, 3, 5 and 7 are all odd, so cannot be 2n for any n. So all terms are >= 3, the 2nd prime.
The 16 possible signed sums of 3, 5, 7 and 11 give 8 nonnegative totals: 2, 4, 6, 10, 12, 16, 20, 26. So a(1) = a(2) = a(3) = a(5) = a(6) = a(8) = a(10) = a(13) = 3.
0 was not one of the 8 totals, and 0 = 5 - 7 - 11 + 13. So a(0) = 5.
		

Programs

  • Python
    from sympy import nextprime
    import numpy as np
    aupto = 100
    A359199 = np.zeros(aupto+1, dtype=object)
    signset = np.array([[ 1,  1,  1,  1] , # green line in visualizations (see links)
                        [ 1,  1,  1, -1] , # red ribbon
                        [ 1,  1, -1,  1] , # red ribbon
                        [ 1, -1,  1,  1] , # red ribbon
                        [ 1,  1, -1, -1] , # magenta ribbon
                        [ 1, -1,  1, -1] , # magenta ribbon
                        [ 1, -1, -1,  1] , # magenta ribbon
                        [ 1, -1, -1, -1]], # red ribbon
                        dtype="i4")
    primeset = np.array([3, 5, 7, 11], dtype=object)
    while all(A359199) == 0:
        for signs in signset:
            asum = abs(sum(signs * primeset)) // 2
            if asum <= aupto and A359199[asum] == 0: A359199[asum] = primeset[0]
        primeset = np.append(primeset, nextprime(primeset[-1]))[1:]
    print(list(A359199))

Formula

For k >= 2, a(A034963(k)/2) = A000040(k).

A094931 A measure of the excess of the mean of the set of 4 consecutive primes over the 2nd of the set.

Original entry on oeis.org

5, 6, 8, 4, 8, 4, 12, 10, 4, 14, 4, 4, 12, 14, 8, 4, 14, 4, 6, 14, 8, 16, 14, 2, 4, 8, 4, 20, 28, 0, 10, 8, 20, 0, 16, 10, 8, 14, 8, 8, 20, 0, 8, 12, 34, 16, 0, 4, 12, 10, 8, 24, 8, 12, 8, 4, 14, 4, 10, 32, 22, 0, 4, 20, 30, 8, 16, 0, 12, 16, 16, 10, 10, 8, 16, 14, 8, 22, 14, 4, 20, 0, 14, 8
Offset: 4

Author

Roger L. Bagula, Jun 17 2004

Keywords

Comments

Let (prime(n-3)+prime(n-2)+prime(n-1)+prime(n))/4 = A034963(n-3)/4 be the arithmetic mean of 4 consecutive primes, and prime(n-2) the third largest. Then A034963(n-3)-4*prime(n-2) is an integer measure of the excess of the mean. We define a(n) by the excess if positive, else by 0.

Crossrefs

Cf. A034963.

Programs

  • Maple
    A094931 := proc(n)
        local p3,p2,p1,p0 ;
        p3 := ithprime(n-3) ;
        p2 := ithprime(n-2) ;
        p1 := ithprime(n-1) ;
        p0 := ithprime(n) ;
        max(p3-3*p2+p1+p0,0) ;
    end proc:
    seq(A094931(n),n=4..50) ; # R. J. Mathar, Nov 15 2019
  • Mathematica
    a=Table[If[(Prime[n-3]+Prime[n-2]+Prime[n-1]+Prime[n])/4-Prime[n-2]>0, 4*((Prime[n-3]+Prime[n-2]+Prime[n-1]+Prime[n])/4-Prime[n-2]), 0], {n, 4, 204}]
    If[#<=0,0,#]&/@(4(Total[#]/4-#[[2]])&/@Partition[Prime[Range[90]],4,1]) (* Harvey P. Dale, Mar 02 2015 *)

A127493 Indices k such that the coefficient [x^1] of the polynomial Product_{j=0..4} (x-prime(k+j)) is prime.

Original entry on oeis.org

1, 5, 8, 9, 22, 29, 45, 49, 60, 69, 87, 89, 90, 107, 114, 124, 125, 131, 134, 138, 145, 156, 171, 183, 188, 191, 203, 204, 207, 212, 219, 255, 261, 290, 298, 303, 329, 330, 343, 344, 349, 354, 378, 397, 398, 400, 403, 454, 456, 466, 474, 515, 549, 560, 570, 578
Offset: 1

Author

Artur Jasinski, Jan 16 2007

Keywords

Comments

A fifth-order polynomial with 5 roots which are the five consecutive primes from prime(k) onward is defined by Product_{j=0..4} (x-prime(k+j)). The sequence is a catalog of the cases where the coefficient of its linear term is prime.
Indices k such that e4(prime(k), prime(k+1), ..., prime(k+4)) is prime, where e4 is the elementary symmetric polynomial summing all products of four variables. - Charles R Greathouse IV, Jun 15 2015

Examples

			For k=2, the polynomial is (x-3)*(x-5)*(x-7)*(x-11)*(x-13) = x^5-39*x^4+574*x^3-3954*x^2+12673*x-15015, where 12673 is not prime, so k=2 is not in the sequence.
For k=5, the polynomial is x^5-83*x^4+2710*x^3-43490*x^2+342889*x-1062347, where 342889 is prime, so k=5 is in the sequence.
		

Programs

  • Maple
    isA127493 := proc(k)
        local x,j ;
        mul( x-ithprime(k+j),j=0..4) ;
        expand(%) ;
        isprime(coeff(%,x,1)) ;
    end proc:
    A127493 := proc(n)
        option remember ;
        if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if isA127493(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A127493(n),n=1..60) ; # R. J. Mathar, Apr 23 2023
  • Mathematica
    a = {}; Do[If[PrimeQ[(Prime[x] Prime[x + 1]Prime[x + 2]Prime[x + 3] + Prime[x] Prime[x + 2]Prime[x + 3]Prime[x + 4] + Prime[x] Prime[x + 1]Prime[x + 3]Prime[x + 4] + Prime[x] Prime[x + 1]Prime[x + 2]Prime[x + 4] + Prime[x + 1] Prime[x + 2]Prime[x + 3]Prime[x + 4])], AppendTo[a, x]], {x, 1, 1000}]; a
  • PARI
    e4(v)=sum(i=1,#v-3, v[i]*sum(j=i+1,#v-2, v[j]*sum(k=j+1,#v-1, v[k]*vecsum(v[k+1..#v]))))
    pr(p, n)=my(v=vector(n)); v[1]=p; for(i=2,#v, v[i]=nextprime(v[i-1]+1)); v
    is(n,p=prime(n))=isprime(e4(pr(p,5)))
    v=List(); n=0; forprime(p=2,1e4, if(is(n++,p), listput(v,n))); Vec(v) \\ Charles R Greathouse IV, Jun 15 2015

Extensions

Definition and comment rephrased and examples added by R. J. Mathar, Oct 01 2009
Previous Showing 31-40 of 47 results. Next