login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A050936 Sum of two or more consecutive prime numbers. 19
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

P. De Geest, WONplate 122

C. Rivera, Puzzle 46

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.

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

CROSSREFS

Cf. A067372 up to A067381, A054996, A000040.

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

Cf. A034707, 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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 9 22:52 EDT 2020. Contains 336335 sequences. (Running on oeis4.)