[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A050940
Numbers that are not the sum (of a nonempty sequence) of consecutive primes.
5
0, 1, 4, 6, 9, 14, 16, 20, 21, 22, 25, 27, 32, 33, 34, 35, 38, 40, 44, 45, 46, 50, 51, 54, 55, 57, 62, 63, 64, 65, 66, 69, 70, 74, 76, 80, 81, 82, 85, 86, 87, 91, 92, 93, 94, 96, 99, 104, 105, 106, 108, 110, 111, 114, 115, 116, 117, 118, 122, 123, 125
OFFSET
1,3
COMMENTS
Where is there a proof that this sequence is infinite? - Carlos Rivera, Apr 17 2002
Moser shows that the average order of A054845 is log(2), and hence this sequence is infinite with lower density at least 1 - log 2 = 0.306.... - Charles R Greathouse IV, Mar 21 2011
LINKS
Franklin T. Adams-Watters, Table of n, a(n) for n = 1..10001
Leo Moser, Notes on number theory. III. On the sum of consecutive primes, Canad. Math. Bull. 6 (1963), pp. 159-161.
FORMULA
A054845(a(n)) = 0. - Ray Chandler, Sep 20 2023
EXAMPLE
The number 14 cannot be expressed as a sum of any consecutive subset of the following primes: {2, 3, 5, 7, 11, 13}.
PROG
(BASIC) 10 N=1 20 N=N+1: if N=prmdiv(N) then goto 20 30 P=1 40 P=nxtprm(P):S=P:Q=P: if S>N\2 then print N; :goto 20 50 Q=nxtprm(Q):S=S+Q 60 if S=N then goto 20 70 if S>N then goto 40 80 goto 50
(PARI) is(n)=if(isprime(n), return(0)); 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(1)); t=vecsum(v); if (t==n, return(0)); 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(1)); if(t==n, return(0))) \\ Charles R Greathouse IV, May 05 2016
CROSSREFS
Complement of A034707.
Sequence in context: A135355 A350069 A245383 * A190434 A310671 A310672
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jan 02 2000
STATUS
approved