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

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

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

A055000 Integers that can be expressed as the sum of consecutive primes in exactly 5 ways.

Original entry on oeis.org

311, 863, 14369, 14699, 15329, 16277, 19717, 20272, 25416, 28500, 29033, 36467, 37607, 40433, 41074, 42463, 45101, 46660, 48731, 49253, 49499, 50560, 53424, 55813, 59068, 67141, 68787, 70104, 70429, 70692, 71548, 76423, 78756, 78791
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)) = 5. - Ray Chandler, Sep 20 2023

A309770 Numbers that are sums of one or more consecutive primes in more than one way.

Original entry on oeis.org

5, 17, 23, 31, 36, 41, 53, 59, 60, 67, 71, 72, 83, 90, 97, 100, 101, 109, 112, 119, 120, 127, 131, 138, 139, 143, 152, 173, 180, 181, 187, 197, 199, 204, 210, 211, 221, 223, 228, 233, 240, 251, 258, 263, 269, 271, 276, 281, 287, 300, 304, 311, 323, 330, 331, 340, 349
Offset: 1

Views

Author

Ilya Gutkovskiy, Aug 16 2019

Keywords

Comments

Contains A067372 as a subsequence.

Examples

			5 is in the sequence because it can be written as either 5 or 2 + 3.
36 is the sequence because it can be written as either 5 + 7 + 11 + 13 or 17 + 19.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # for terms <= N
    P:= select(isprime, [2, seq(i,i=3..N,2)]):
    S:= [0,op(ListTools:-PartialSums(P))]:
    V:= Vector(N):
    for i from 1 to nops(S) do
      for j from i-1 to 1 by -1 do
        v:= S[i]-S[j];
        if v > N then break fi;
        V[v]:= V[v]+1;
    od od:
    select(t -> V[t]>1, [$1..N]); # Robert Israel, Aug 22 2019

Formula

A054845(a(n)) > 1.
Showing 1-7 of 7 results.