OFFSET
1,1
LINKS
Sean A. Irvine, Java program (github)
Carlos Rivera, Problem 9. Let f(n) be the number of ways of representing n as the sum of one or more consecutive primes. Is f(n)=k solvable for every k?, The Prime Puzzles and Problems Connection.
EXAMPLE
a(2) = 5 because of 5 and 2+3 = 5. a(3) = 41 because of 41, 2+3+5+7+11+13 = 41 and 11+13+17 = 41.
MATHEMATICA
lim = 500000; cnt = Table[If[OddQ[n] && PrimeQ[n], 1, 0], {n, lim}]; ps = Prime[Range[PrimePi[lim]]]; sm = ps; i = 0; While[i++; j = 1; While[sm[[j]] = sm[[j]] + ps[[i + j]]; sm[[j]] <= lim, If[OddQ[sm[[j]]], cnt[[sm[[j]]]]++]; j++]; j > 1]; Table[Position[cnt, i, 1, 1][[1, 1]], {i, Union[cnt][[-1]]}] (* T. D. Noe, Nov 03 2011 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jason Earls, Apr 06 2001
EXTENSIONS
Edited by Larry Reeves (larryr(AT)acm.org), Apr 25 2001
a(10) from Sean A. Irvine, Nov 20 2022
STATUS
approved