OFFSET
1,1
COMMENTS
A050936 is a subsequence (which still includes primes, embodied by A067377). - Enoch Haga, Jun 16 2002, R. J. Mathar, Oct 10 2010
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
Leo Moser, On the Sum of Consecutive Primes. Canad. Math. Bull. 6 (1963), 159-161.
Janyarak Tongsomporn, Saeree Wananiyaku, and Jörn Steuding, Sums of consecutive prime squares, Integers (2022) Vol. 22, #A9.
FORMULA
A054845(a(n)) > 0. - Ray Chandler, Sep 20 2023
MATHEMATICA
f[n_] := Block[{len = PrimePi@ n}, p = Prime@ Range@ len; Count[ Flatten[ Table[ p[[i ;; j]], {i, len}, {j, i, len}], 1], q_ /; Total@ q == n]]; Select[ Range@ 1000, f@ # > 0 &] (* Or quicker for a larger range *)
lmt = 10000; p = Prime@ Range@ PrimePi@ lmt; t = Table[0, {lmt}]; Do[s = 0; j = i; While[s = s + p[[j]]; s <= lmt, t[[s]]++; j++], {i, Length@ p}]; Select[ Range@ lmt, t[[#]] > 0 &]
upto=200; Select[Union[Flatten[Table[ Total/@Partition[Prime[ Range[ PrimePi[ upto]]], n, 1], {n, upto-1}]]], #<=upto&] (* Harvey P. Dale, Jul 15 2011 *)
PROG
(PARI) is(n)=if(isprime(n), return(1)); 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
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
Updated a misleading comment. - R. J. Mathar, Oct 10 2010
STATUS
approved