login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A054845 Number of ways of representing n as the sum of one or more consecutive primes. 12
0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 1, 0, 1, 0, 1, 1, 1, 2, 0, 0, 0, 0, 2, 1, 0, 1, 0, 3, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 2, 0, 0, 1, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 2, 2, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 3, 1, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 1, 0, 2, 1, 0, 2, 2 (list; graph; refs; listen; history; internal format)
OFFSET

0,6

COMMENTS

Moser shows that the average order of a(n) is log 2, that is, sum(i=1..n, a(i)) ~ n log 2.  This shows that a(n) = 0 infinitely often (and with positive density); Moser asks if a(n) = 1 infinitely often, if a(n) = k is solvable for all k, whether these have positive density, and whether the sequence is bounded. [Charles R Greathouse IV, Mar 21, 2011]

REFERENCES

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

LINKS

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

Leo Moser, Notes on number theory. III. On the sum of consecutive primes, Canad. Math. Bull. 6 (1963), pp. 159-161.

C. Rivera, Prime Puzzles

EXAMPLE

a(5)=2 because of 2+3 and 5. a(17)=2 because of 2+3+5+7 and 17.

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

MATHEMATICA

f[n_] := Block[{p = Prime@ Range@ PrimePi@ n}, len = Length@ p; Count[(Flatten[#, 1] &)[Table[ p[[i ;; j]], {i, len}, {j, i, len}]], q_ /; Total@ q == n]]; f[0] = 0; Array[f, 102, 0](* Jean-François Alcover, Feb 16 2011*) (* fixed by RGWv *)

nn=100; p=Prime[Range[PrimePi[nn]]]; t=Table[0, {nn}]; Do[s=0; j=i; While[s=s+p[[j]]; s<=nn, t[[s]]++; j++], {i, Length[p]}]; Join[{0}, t]

PROG

(PARI){/* program gives nn+1 values of a(n) for n=0..nn */

nn=2000; t=vector(nn+1); forprime(x=2, nn, s=x;

  forprime(y=x+1, nn, if(s<=nn, t[s+1]++, break()); s=s+y)); t} [Zak Seidov, Feb 17 2011]

(MAGMA) S:=[0]; for n in [1..104] do count:=0; for q in PrimesUpTo(n) do p:=q; s:=p; while s lt n do p:=NextPrime(p); s+:=p; end while; if s eq n then count+:=1; end if; end for; Append(~S, count); end for; S; // Klaus Brockhaus, Feb 17 2011

CROSSREFS

Cf. A000586, A054859.

Sequence in context: A141571 A164067 A113706 * A117163 A096863 A117210

Adjacent sequences:  A054842 A054843 A054844 * A054846 A054847 A054848

KEYWORD

nice,nonn

AUTHOR

Jud McCranie (JudMcCranie(AT)ugaalum.uga.edu), May 25 2000

EXTENSIONS

Edited by N. J. A. Sloane (njas(AT)research.att.com), Oct 27 2008 at the suggestion of Jake M. Foster.

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 16 10:07 EST 2012. Contains 205904 sequences.