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 14 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

A054859 Smallest positive integer that can be expressed as the sum of consecutive primes in exactly n ways.

Original entry on oeis.org

1, 2, 5, 41, 1151, 311, 34421, 218918, 3634531, 48205429, 1798467197, 12941709050, 166400805323, 6123584726269
Offset: 0

Views

Author

Jud McCranie, May 25 2000

Keywords

Comments

a(10)-a(12) found by Wilfred Whiteside in 2007. - Giovanni Resta, May 07 2020

Examples

			41 = 41 = 11+13+17 = 2+3+5+7+11+13, 41 is the smallest number expressible in 3 ways, so a(3)=41.
From _Robert G. Wilson v_, Feb 21 2011: (Start)
a(0) = 1 because 1 cannot be expressed as the sum of any set of consecutive primes,
a(1) = 2 because 2 is the first prime,
a(2) = 5 because 2+3 = 5,
a(4) = 1151 because 7+11+13+17+19+23+29+31+37+41+43+47+53+59+61+67+71+73+79+83+89+97+101 = 223+227+229+233+239 = 379+383+389 = 1151,
a(5) = 311 because 11+13+17+19+23+29+31+37+41+43+47 = 31+37+41+43+47+53+59 = 53+59+61+67+71 = 101+103+107 = 311,
a(6) = 34421 because  269+271+...+701+709 = 1429+1433+...+1567+1571 = 3793+3797+3803+3821+3823+3833+3847+3851+3853 = 4889+4903+4909+4919+4931+4933+4937 = 11467+11471+11483 = 34421,
a(7) = 218918 because 3301+3307+...+3767+3769 = 4561+4567+...+4951+4957 = 5623+5639+...+5881+5897 = 7691+7699+...+7933+7937 = 9851+9857+...+10067+10069  = 13619+13627+...+13723+13729 = 18199+18211+...+18287+18289,
a(8) = 3634531 because 313+317+...+7873+7877 = 977+983+...+7933+7937 = 31567+31573+...+32707+32713 = 70997+70999+...+71479+71483 = 73897+73907+...+74413+74419 = 172969+172973+...+173189+173191 = 519161+519193+...+519247+519257 = 3634531,
a(9) = 48205429 because 124291+124297+...+128747+128749 = 176303+176317+...+179453+179461 = 331537+331543+...+333383+333397 = 433577+433607+...+434933+434939 = 541061+541087+...+542141+542149 = 2536943+2536991+...+2537303+2537323 = 16068461+16068469+16068499 = 48205429, etc. (End)
From _Giovanni Resta_, May 07 2020: (Start)
The runs of primes corresponding to a(10)-a(13), in the format first prime (run length), are:
a(10) = 1798467197 (1), 599489047 (3), 51384499 (35), 41824483 (43), 14862469 (121), 2233859 (803), 1652909 (1083), 742243 (2371), 280591 (5683), 118297 (10073);
a(11) = 6470854519 (2), 2156951369 (6), 431390039 (30), 323542441 (40), 71896949 (180), 56266367 (230), 5574659 (2314), 4481189 (2874), 3547639 (3620), 1487399 (8366), 993197 (12024);
a(12) = 166400805323 (1), 55466935091 (3), 18488978293 (9), 3025468583 (55), 155650259 (1069), 135604109 (1227), 50227297 (3311), 29640257 (5605), 19365569 (8561), 6284627 (25655), 3188819 (46977), 429467 (127483);
a(13) = 6123584726269 (1), 360210866021 (17), 197534990813 (31), 124971116311 (49), 48217200953 (127), 40023427859 (153), 21188870723 (289), 13225879553 (463), 6166740911 (993), 3642804197 (1681), 2232410683 (2743), 992896649 (6167), 17062531 (311319). (End)
		

References

  • R. K. Guy, Unsolved Problems In Number Theory, C2.

Crossrefs

Programs

  • Mathematica
    lmt = 500000000; p = Prime@ Range@ PrimePi@ lmt; t = Table[0, {lmt}]; Do[s = 0; j = i; While[s = s + p[[j]]; s <= lmt, t[[s]]++; j++], {i, Length@ p}]; Table[ Position[t, n, 1, 1], {n, 0, 0}] (* Robert G. Wilson v, Feb 21 2011 *)

Extensions

a(10)-a(11) from Bert Dobbelaere, Apr 14 2020
a(12)-a(13) from Giovanni Resta, May 07 2020

A034707 Numbers that are sums (of a nonempty sequence) of consecutive primes.

Original entry on oeis.org

2, 3, 5, 7, 8, 10, 11, 12, 13, 15, 17, 18, 19, 23, 24, 26, 28, 29, 30, 31, 36, 37, 39, 41, 42, 43, 47, 48, 49, 52, 53, 56, 58, 59, 60, 61, 67, 68, 71, 72, 73, 75, 77, 78, 79, 83, 84, 88, 89, 90, 95, 97, 98, 100, 101, 102, 103, 107, 109, 112, 113, 119, 120, 121, 124, 127
Offset: 1

Views

Author

Keywords

Comments

A050936 is a subsequence (which still includes primes, embodied by A067377). - Enoch Haga, Jun 16 2002, R. J. Mathar, Oct 10 2010

Crossrefs

Complement is A050940.

Programs

  • Mathematica
    f[n_] := Block[{len = PrimePi@ n}, p = Prime@ Range@ len; Count[ Flatten[ Table[ p[[i ;; j]], {i, len}, {j, i, len}],1], q_ /; Total@ q == n]]; Select[ Range@ 1000, f@ # > 0 &] (* Or quicker for a larger range *)
    lmt = 10000; p = Prime@ Range@ PrimePi@ lmt; t = Table[0, {lmt}]; Do[s = 0; j = i; While[s = s + p[[j]]; s <= lmt, t[[s]]++; j++], {i, Length@ p}]; Select[ Range@ lmt, t[[#]] > 0 &]
    upto=200;Select[Union[Flatten[Table[ Total/@Partition[Prime[ Range[ PrimePi[ upto]]],n,1],{n,upto-1}]]],#<=upto&] (* Harvey P. Dale, Jul 15 2011 *)
  • PARI
    is(n)=if(isprime(n), return(1)); 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

Formula

A054845(a(n)) > 0. - Ray Chandler, Sep 20 2023

Extensions

Updated a misleading comment. - R. J. Mathar, Oct 10 2010

A054996 Integers that can be expressed as the sum of consecutive primes in exactly 1 way.

Original entry on oeis.org

2, 3, 7, 8, 10, 11, 12, 13, 15, 18, 19, 24, 26, 28, 29, 30, 37, 39, 42, 43, 47, 48, 49, 52, 56, 58, 61, 68, 73, 75, 77, 78, 79, 84, 88, 89, 95, 98, 102, 103, 107, 113, 121, 124, 128, 129, 132, 137, 144, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			8=3+5, so 8 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 1. - Ray Chandler, Sep 20 2023

A054998 Integers that can be expressed as the sum of consecutive primes in exactly 3 ways.

Original entry on oeis.org

41, 83, 197, 199, 223, 240, 251, 281, 287, 340, 371, 401, 439, 491, 510, 593, 660, 733, 803, 857, 864, 883, 931, 941, 961, 983, 990, 991, 1012, 1060, 1061, 1099, 1104, 1187, 1236, 1283, 1313, 1361, 1381, 1392, 1433, 1439, 1493, 1511, 1523, 1524, 1553
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			41 can be expressed as 41 or 11+13+17 or 2+3+5+7+11+13, so 41 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Programs

  • Maple
    N:= 10^4: # to get all terms <= N
    P:= [0,op(select(isprime, [2,seq(i,i=3..N,2)]))]:
    nP:= nops(P);
    S:= ListTools:-PartialSums(P):
    V:= Vector(N):
    for i from 1 to nP-1 do
      for j from i+1 to nP while S[j] - S[i] <= N do
         V[S[j]-S[i]]:= V[S[j]-S[i]]+1
    od od:
    select(t -> V[t] = 3, [$1..N]): # Robert Israel, Apr 05 2017
  • Mathematica
    Module[{nn = 300, s}, s = Array[Prime, nn]; Keys@ Take[Select[KeySort@ Merge[Table[PositionIndex@ Map[Total, Partition[s, k, 1]], {k, nn/2}], Identity], Length@ # == 3 &], Floor[nn/6]]] (* Michael De Vlieger, Apr 06 2017, Version 10 *)

Formula

A054845(a(n)) = 3. - Ray Chandler, Sep 20 2023

A054999 Integers that can be expressed as the sum of consecutive primes in exactly 4 ways.

Original entry on oeis.org

1151, 1164, 1320, 1367, 1650, 1854, 1951, 2393, 2647, 2689, 2856, 2867, 3198, 3264, 3389, 3754, 4200, 4920, 4957, 5059, 5100, 5153, 5770, 5999, 6504, 7451, 7901, 8152, 8819, 10134, 10320, 10499, 10536, 10649, 10859, 10949, 11058, 12294
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 4. - Ray Chandler, Sep 20 2023

A054997 Integers that can be expressed as the sum of consecutive primes in exactly 2 ways.

Original entry on oeis.org

5, 17, 23, 31, 36, 53, 59, 60, 67, 71, 72, 90, 97, 100, 101, 109, 112, 119, 120, 127, 131, 138, 139, 143, 152, 173, 180, 181, 187, 204, 210, 211, 221, 228, 233, 258, 263, 269, 271, 276, 300, 304, 323, 330, 331, 349, 353, 372, 373, 379, 384, 390, 395, 408
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			5 can be expressed as 5 or 2+3, so 5 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 2. - Ray Chandler, Sep 20 2023

A055001 Integers that can be expressed as the sum of consecutive primes in exactly 6 ways.

Original entry on oeis.org

34421, 130638, 229841, 235493, 271919, 295504, 345011, 347856, 358446, 358877, 414221, 429804, 434669, 480951, 488603, 532423, 532823, 543625, 561375, 621937, 626852, 655561, 687496, 703087, 734069, 746829, 810418, 824099, 888793
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 6. - Ray Chandler, Sep 20 2023

A307610 Number of partitions of prime(n) into consecutive primes.

Original entry on oeis.org

1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1, 2, 2, 1, 1, 3, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 3, 2, 3, 1, 1, 2, 1, 1, 3, 1, 2, 2, 2, 1, 3, 1, 1, 1, 5, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 3, 1, 1, 2, 2, 1, 3, 2, 2, 2, 1, 2, 1, 2, 2, 3, 2, 2, 1, 1, 2
Offset: 1

Views

Author

Ilya Gutkovskiy, Apr 18 2019

Keywords

Comments

a(n) - 1 = number of partitions of prime(n) into two or more consecutive primes. - Ray Chandler, Sep 26 2023

Examples

			prime(13) = 41 = 2 + 3 + 5 + 7 + 11 + 13 = 11 + 13 + 17, so a(13) = 3.
		

Crossrefs

Formula

a(n) = [x^prime(n)] Sum_{i>=1} Sum_{j>=i} Product_{k=i..j} x^prime(k).
a(n) = A054845(A000040(n)).

A050940 Numbers that are not the sum (of a nonempty sequence) of consecutive primes.

Original entry on oeis.org

0, 1, 4, 6, 9, 14, 16, 20, 21, 22, 25, 27, 32, 33, 34, 35, 38, 40, 44, 45, 46, 50, 51, 54, 55, 57, 62, 63, 64, 65, 66, 69, 70, 74, 76, 80, 81, 82, 85, 86, 87, 91, 92, 93, 94, 96, 99, 104, 105, 106, 108, 110, 111, 114, 115, 116, 117, 118, 122, 123, 125
Offset: 1

Views

Author

N. J. A. Sloane, Jan 02 2000

Keywords

Comments

Where is there a proof that this sequence is infinite? - Carlos Rivera, Apr 17 2002
Moser shows that the average order of A054845 is log(2), and hence this sequence is infinite with lower density at least 1 - log 2 = 0.306.... - Charles R Greathouse IV, Mar 21 2011

Examples

			The number 14 cannot be expressed as a sum of any consecutive subset of the following primes: {2, 3, 5, 7, 11, 13}.
		

Crossrefs

Complement of A034707.

Programs

  • BASIC
    10 N=1 20 N=N+1: if N=prmdiv(N) then goto 20 30 P=1 40 P=nxtprm(P):S=P:Q=P: if S>N\2 then print N;:goto 20 50 Q=nxtprm(Q):S=S+Q 60 if S=N then goto 20 70 if S>N then goto 40 80 goto 50
    
  • PARI
    is(n)=if(isprime(n), return(0)); 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(1)); t=vecsum(v); if (t==n, return(0)); 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

Formula

A054845(a(n)) = 0. - Ray Chandler, Sep 20 2023
Showing 1-10 of 14 results. Next