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

 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. 15
 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; text; 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. Leo Moser, Notes on number theory. III. On the sum of consecutive primes, Canad. Math. Bull. 6 (1963), pp. 159-161. LINKS T. D. Noe, Table of n, a(n) for n = 0..10000 C. Rivera, Problem 9, Prime Puzzles. FORMULA G.f.: Sum_{i>=1} Sum_{j>=i} Product_{k=i..j} x^prime(k). - Ilya Gutkovskiy, Apr 18 2019 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. MAPLE A054845 := proc(n)     local a, mipri, npr, ps ;     a := 0 ;     for mipri from 1 do         for npr from 1 do             ps := add(ithprime(i), i=mipri..mipri+npr-1) ;             if ps = n then                 a := a+1 ;             elif ps >n then                 break;             end if;         end do:         if ithprime(mipri) > n then             break ;         end if;     end do:     a ; end proc: # R. J. Mathar, Nov 27 2018 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 Robert G. Wilson v *) 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 (Perl) use ntheory ":all"; my \$n=10000; my @W=(0)x(\$n+1); forprimes { my \$s=\$_; do { \$W[\$s]++; \$s += (\$_=next_prime(\$_)); } while \$s <= \$n; } \$n; print "\$_ \$W[\$_]\n" for 0..\$#W;  # Dana Jacobsen, Aug 22 2018 CROSSREFS Cf. A000586, A054859. Sequence in context: A305490 A113706 A279952 * A317991 A236853 A117163 Adjacent sequences:  A054842 A054843 A054844 * A054846 A054847 A054848 KEYWORD nice,nonn AUTHOR Jud McCranie, May 25 2000 EXTENSIONS Edited by N. J. A. Sloane, Oct 27 2008 at the suggestion of Jake M. Foster 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.

Last modified September 24 21:25 EDT 2020. Contains 337322 sequences. (Running on oeis4.)