login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A050936 Sum of two or more consecutive prime numbers. 27
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

T. D. Noe, Table of n, a(n) for n = 1..10000

Patrick De Geest, WONplate 122

Carlos Rivera, Puzzle 46. Primes expressible as sum of consecutive primes in K ways, The Prime Puzzles and Problems Connection.

Eric Weisstein's World of Mathematics, Prime Sums

EXAMPLE

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.

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

PROG

(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

(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(t<n, t-=v[1]; v=concat(v[2..m], nextprime(v[m]+1)); t+=v[m])); if(v[1]==0, return(0)); if(t==n, return(1))) \\ Charles 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

CROSSREFS

Subsequence of A034707.

Cf. A067372 up to A067381, A054996, A000040.

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

Cf. A054845, A097889.

Sequence in context: A314379 A153663 A065528 * A084146 A314380 A332513

Adjacent sequences: A050933 A050934 A050935 * A050937 A050938 A050939

KEYWORD

nice,nonn,easy

AUTHOR

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

EXTENSIONS

More terms from David W. Wilson, Jan 13 2000

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 28 10:39 EST 2022. Contains 358411 sequences. (Running on oeis4.)