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

A050936 Sum of two or more consecutive prime numbers.

Original entry on oeis.org

5, 8, 10, 12, 15, 17, 18, 23, 24, 26, 28, 30, 31, 36, 39, 41, 42, 48, 49, 52, 53, 56, 58, 59, 60, 67, 68, 71, 72, 75, 77, 78, 83, 84, 88, 90, 95, 97, 98, 100, 101, 102, 109, 112, 119, 120, 121, 124, 127, 128, 129, 131, 132, 138, 139, 143, 144, 150, 152, 155, 156, 158, 159, 160, 161, 162
Offset: 1

Views

Author

G. L. Honaker, Jr., Dec 31 1999

Keywords

Examples

			E.g., 5 = (2 + 3) or (#2,2).
2+3 = 5, 3+5 = 8, 2+3+5 = 10, 7+5 = 12, 3+5+7 = 15, etc.
		

Crossrefs

Subsequence of A034707.
A084143(a(n)) > 0, complement of A087072.

Programs

  • Haskell
    import Data.Set (empty, findMin, deleteMin, insert)
    import qualified Data.Set as Set (null)
    a050936 n = a050936_list !! (n-1)
    a050936_list = f empty [2] 2 $ tail a000040_list where
       f s bs c (p:ps)
         | Set.null s || head bs <= m = f (foldl (flip insert) s bs') bs' p ps
         | otherwise                  = m : f (deleteMin s) bs c (p:ps)
         where m = findMin s
               bs' = map (+ p) (c : bs)
    -- Reinhard Zumkeller, Aug 26 2011
    
  • Maple
    # uses code of A084143
    isA050936 := proc(n::integer)
        if A084143(n) >= 1 then
            true;
        else
            false;
        end if;
    end proc:
    for n from 1 to 300 do
        if isA050936(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Aug 19 2020
  • Mathematica
    lst={};Do[p=Prime[n];Do[p=p+Prime[k];AppendTo[lst, p], {k, n+1, 2*10^2}], {n, 2*10^2}];Take[Union[lst], 10^2] (* Vladimir Joseph Stephan Orlovsky, Aug 21 2008 *)
    f[n_] := Block[{len = PrimePi@ n}, p = Prime@ Range@ len; Count[ Flatten[ Table[ p[[i ;; j]], {i, len}, {j, i+1, len}],1], q_ /; Total@ q == n]]; Select[ Range@ 150, f@ # > 0 &] (* Or quicker for a larger range *)
    lmt = 150; p = Prime@ Range@ PrimePi@ lmt; t = Table[0, {lmt}]; Do[s = 0; j = i+1; While[s = s + p[[j]]; s <= lmt, t[[s]]++; j++], {i, Length@ p}]; Select[ Range@ lmt, t[[#]] > 0 &] (* Robert G. Wilson v *)
    Module[{nn=70,prs},prs=Prime[Range[nn]];Take[Union[Flatten[Table[Total/@ Partition[prs,i,1],{i,2,nn}]]],nn]] (* Harvey P. Dale, Nov 13 2013 *)
  • PARI
    is(n)=my(v,m=1,t); while(1,v=vector(m++); v[m\2]=precprime(n\m); for(i=m\2+1,m, v[i]=nextprime(v[i-1]+1)); forstep(i=m\2-1,1,-1, v[i]=precprime(v[i+1]-1)); if(v[1]==0, return(0)); t=vecsum(v); if(t==n,return(1)); if(t>n, while(t>n,t-=v[m]; v=concat(precprime(v[1]-1), v[1..m-1]); t+=v[1]), while(tCharles R Greathouse IV, May 05 2016
    
  • PARI
    list(lim)=my(v=List(),s,n=1,p); while(1, p=2; s=vecsum(primes(n++)); if(s>lim,return(Set(v))); listput(v,s); forprime(q=prime(n+1),, s+=q-p; if(s>lim,break); listput(v,s); p=nextprime(p+1))); \\ Charles R Greathouse IV, Nov 24 2021

Extensions

More terms from David W. Wilson, Jan 13 2000

A067381 Smallest prime expressible as the sum of (at least two) consecutive primes in n ways.

Original entry on oeis.org

5, 41, 311, 311, 34421, 442019, 3634531, 48205429, 1798467197, 36154343837, 166400805323, 6123584726269
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Comments

a(9)-a(11) found by Wilfred Whiteside in 2007.

Examples

			5 can be represented (in just one way) as 2+3.
		

Crossrefs

Extensions

a(12) from Giovanni Resta, May 07 2020

A067377 Primes expressible as the sum of (at least two) consecutive primes in at least 1 way.

Original entry on oeis.org

5, 17, 23, 31, 41, 53, 59, 67, 71, 83, 97, 101, 109, 127, 131, 139, 173, 181, 197, 199, 211, 223, 233, 251, 263, 269, 271, 281, 311, 331, 349, 353, 373, 379, 401, 421, 431, 439, 443, 449, 457, 463, 479, 487, 491, 499, 503, 523, 563, 587, 593, 607, 617, 631, 647, 659, 661, 677, 683, 691, 701, 719
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Examples

			The prime 83, for example, is the sum of the five consecutive primes 11 + 13 + 17 + 19 + 23.
The prime 2011, for example, is the sum of the eleven consecutive primes 157 + 163 + 167 + 173 + 179 + 181 + 191 + 193 + 197 + 199 + 211. - _Daniel Forgues_, Nov 03 2011
		

Crossrefs

Cf. A197227 (primes that are not the sum of consecutive primes).

Programs

  • Mathematica
    p = {}; Do[a = Table[ Prime[i], {i, n, 150}]; l = Length[a]; k = 2; While[k < l + 1, b = Plus @@@ Partition[a, k]; k++; p = Append[ p, Select[ b, PrimeQ[ # ] &]]], {n, 1, 149}]; Take[ Union[ Flatten[p]], 70]
    m=5!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[PrimeQ[p]&&p<=Prime[m]*3+8,AppendTo[lst,p]],{b,a+1,m+2,1}],{a,m}]; Union[lst] (* Vladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

Prime(n) such that A307610(n) > 1. - Ray Chandler, Sep 21 2023

Extensions

Offset changed to 1 by Hans Havermann, Oct 07 2018

A067380 Primes expressible as the sum of (at least two) consecutive primes in at least 4 ways.

Original entry on oeis.org

311, 863, 14369, 14699, 15329, 19717, 29033, 34421, 36467, 37607, 40433, 42463, 48731, 49253, 49499, 55813, 67141, 70429, 76423, 78791, 85703, 90011, 94559, 97159, 98411, 109159, 110359, 110527, 125821, 130513, 134921, 141587, 147031, 147347, 155087, 155387
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Comments

Note that the definition says "at least two", so a(n) = a(n) itself is not allowed as a possible sum (see Examples).

Examples

			311 is a term because 311 is prime and
  11+13+17+19+23+29+31+37+41+43+47 = 311,
  31+37+41+43+47+53+59 = 311,
  53+59+61+67+71 = 311,
  101+103+107 = 311.
1151 is not a term, since although 1151 is prime it only has three representations of the required form:
  101+97+89+83+79+73+71+67+61+59+53+47+43+41+37+31+29+23+19+17+13+11+7 = 1151,
  239+233+229+227+223 = 1151,
  389+383+379 = 1151.
Also, 16277 is not a term because although it has five representations as a sum of consecutive primes, it is not itself a prime. - _Sean A. Irvine_, Dec 25 2021
		

Crossrefs

Programs

  • Magma
    M:=160000; P:=PrimesUpTo(M); S:=[0]; for p in P do t:=S[#S]+p; if #S ge 3 then if t-S[#S-2] gt M then break; end if; end if; S[#S+1]:=t;end for; c:=[0:j in [1..M]]; for C in [2..#S-1] do if IsEven(C) then L:=1; else L:=#S-C; end if; for j in [1..L] do s:=S[j+C]-S[j]; if s gt M then break; end if; if IsPrime(s) then c[s]+:=1; end if; end for; end for; [j:j in [1..M]|c[j] ge 4]; // Jon E. Schoenfield, Dec 25 2021
  • Mathematica
    m=7!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[PrimeQ[p]&&pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

Prime(n) such that A307610(n) > 4. - Ray Chandler, Sep 21 2023

Extensions

The terms have been confirmed by Sean A. Irvine, Dec 24 2021. - N. J. A. Sloane, Dec 25 2021

A067378 Primes expressible as the sum of (at least two) consecutive primes in at least 2 ways.

Original entry on oeis.org

41, 83, 197, 199, 223, 251, 281, 311, 401, 439, 491, 593, 733, 857, 863, 883, 941, 983, 991, 1061, 1151, 1187, 1283, 1361, 1367, 1381, 1433, 1439, 1493, 1511, 1523, 1553, 1607, 1753, 1801, 1823, 1901, 1951, 2011, 2027, 2099, 2111, 2179, 2203, 2267, 2357, 2393, 2417, 2579, 2647, 2689, 2731
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Crossrefs

Programs

  • Mathematica
    m=3*5!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[PrimeQ[p]&&pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)
  • PARI
    e=2500; for(d=2,e, if(d%2==1,h=d/3,h=d/2); f=floor(2*d/(log(d)*3)); g=0; for(c=1,f,a=0; b=0; forprime(n=prime(c),h+50,a=a+n; b=b+1;if (a==d,g=g+1; if(g>=2&isprime(a),print1(a, ", ")),if(a>d,next(2)))))) /* The parameter g selects the number of ways wanted. - Robin Garcia, Jan 11 2011 */

Formula

Prime(n) such that A307610(n) > 2. - Ray Chandler, Sep 21 2023

A067379 Primes expressible as the sum of (at least two) consecutive primes in at least 3 ways.

Original entry on oeis.org

311, 863, 1151, 1367, 1951, 2393, 2647, 2689, 3389, 4957, 5059, 5153, 7451, 7901, 8819, 10499, 10859, 10949, 12329, 12641, 12713, 13127, 13297, 14369, 14699, 14759, 14951, 15091, 15329, 15527, 16223, 16249, 16829, 18089, 18311, 18401
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Crossrefs

Programs

  • Mathematica
    m=2*6!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[PrimeQ[p]&&pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

Prime(n) such that A307610(n) > 3. - Ray Chandler, Sep 21 2023

A067373 Integers expressible as the sum of (at least two) consecutive primes in at least 3 ways.

Original entry on oeis.org

240, 287, 311, 340, 371, 510, 660, 803, 863, 864, 931, 961, 990, 1012, 1060, 1099, 1104, 1151, 1164, 1236, 1313, 1320, 1367, 1392, 1524, 1643, 1650, 1710, 1788, 1793, 1854, 1951, 1956, 2040, 2303, 2304, 2387, 2393, 2436, 2507, 2556, 2586, 2647, 2670
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Examples

			240 = (113 + 127) = (53 + 59 + 61 + 67) = (17 + 19 + 23 + 29 + 31 + 37 + 41 + 43) or (#2,113) (#4,53) (#8,17).
		

Crossrefs

Programs

  • Mathematica
    m=3*5!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

A084143(a(n)) > 2. - Ray Chandler, Sep 20 2023

Extensions

Offset corrected by Donovan Johnson, Nov 14 2013

A067374 Integers expressible as the sum of (at least two) consecutive primes in at least 4 ways.

Original entry on oeis.org

311, 863, 1164, 1320, 1650, 1854, 2856, 2867, 3198, 3264, 3754, 4200, 4920, 5100, 5770, 5999, 6504, 8152, 10134, 10320, 10536, 10649, 11058, 12294, 12438, 12762, 12820, 12954, 12990, 14369, 14699, 14826, 15329, 15610, 15762, 16199, 16277
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Examples

			E.g., 311 = 101 + 103 + 107 = 53 + 59 + 61 + 67 + 71 = 31 + 37 + 41 + 43 + 47 + 53 + 59 = 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47.
		

Crossrefs

Programs

  • Mathematica
    Clear[lst,lst1,m,n,p,a,b] m=2*6!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

A084143(a(n)) > 3. - Ray Chandler, Sep 20 2023

Extensions

Offset corrected by Donovan Johnson, Nov 14 2013

A067375 Integers expressible as the sum of (at least two) consecutive primes in at least 5 ways.

Original entry on oeis.org

16277, 20272, 25416, 28500, 34421, 41074, 45101, 46660, 50560, 53424, 59068, 68787, 70104, 70692, 71548, 78756, 85433, 85481, 88453, 94350, 98881, 105827, 117907, 120151, 121847, 125952, 130638, 130789, 131420, 132539, 133367, 134376, 135918, 139853, 158810
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Examples

			E.g. 16277 = (#7,2297) (#11,1451) (#13,1213) (#35,359) (#37,331).
		

Crossrefs

Programs

  • Mathematica
    t={};Do[p=Prime[m];Do[p=p+Prime[n];If[p<200000,AppendTo[t,p]],{n,m+1,7001}],{m,1,7000}];t=Sort@t;f5[l_]:=Module[{t={}},Do[If[l[[n]]==l[[n+4]],AppendTo[t,l[[n]]]],{n,Length[l]-4}];t];Union@f5[t] (* Vladimir Joseph Stephan Orlovsky, Jan 30 2012 *)

Formula

A084143(a(n)) > 4. - Ray Chandler, Sep 20 2023

Extensions

Offset and a(35) corrected by Donovan Johnson, Nov 14 2013

A084147 Integers that have exactly 2 representations as sums of consecutive primes.

Original entry on oeis.org

36, 41, 60, 72, 83, 90, 100, 112, 119, 120, 138, 143, 152, 180, 187, 197, 199, 204, 210, 221, 223, 228, 251, 258, 276, 281, 300, 304, 323, 330, 372, 384, 390, 395, 401, 408, 410, 434, 439, 456, 462, 473, 480, 491, 492, 508, 533, 540, 551, 552, 558, 559, 576
Offset: 1

Views

Author

Eric W. Weisstein, May 15 2003

Keywords

Comments

More fundamental than A067372, which gives integers having 2 *or more* such representations

Examples

			36 is in the sequence because it can be written in exactly two ways as sum of consecutive primes: 17+19 and 5+7+11+13.
		

Crossrefs

Programs

  • Maple
    g:=sum(sum(product(x^ithprime(k),k=i..j),j=i+1..150),i=1..150): gser:=series(g,x=0,605): a:=proc(n) if coeff(gser,x^n)=2 then op(2,x^n) else fi end: seq(a(n),n=1..600); # Emeric Deutsch, Mar 30 2006
    # Alternative
    N:= 70: # for terms up to prime(N-1)+prime(N)
    P:= [seq(ithprime(i),i=1..N)]: m:= P[N-1]+P[N]:
    S:= ListTools:-PartialSums(P):
    V:= Vector(m):
    for i from 2 while S[i] <= m do V[S[i]]:= 1 od:
    for i from 1 to N-2 do
      for j from i+2 to N while S[j]-S[i] <= m do V[S[j]-S[i]]:= V[S[j]-S[i]] + 1
    od od:
    select(t -> V[t] = 2, [$1..m]); # Robert Israel, Feb 14 2021
  • Mathematica
    With[{nn=100},Take[Sort[Select[Tally[Flatten[Table[Total/@Partition[Prime[Range[nn]],n,1],{n,2,nn}]]],#[[2]]==2&]][[All,1]],nn]] (* Harvey P. Dale, Mar 06 2020 *)

Extensions

More terms from John W. Layman, May 21 2003
Showing 1-10 of 13 results. Next