OFFSET
1,4
COMMENTS
The frequency of each possible sum is computed by the Mathematica program without explicitly computing the individual sums. Let S = 3 + 5 + 7 + ... + prime(2n+1). Because the primes do not grow very fast, it is easy to show that, for n > 2, all even numbers between -S+20 and S-20 occur at least once as a sum.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..1000 (first 100 terms from T. D. Noe)
T. D. Noe, Extremal Sums of Sequences.
FORMULA
a(n) = A022897(2n). - M. F. Hasler, Aug 08 2015
EXAMPLE
a(3) = 1 because there is only one sign pattern of the first six odd primes that yields zero: 3 + 5 + 7 - 11 + 13 - 17.
MATHEMATICA
d={1, 0, 0, 1}; nMax=32; zeroLst={}; Do[p=Prime[n+1]; d=PadLeft[d, Length[d]+p]+PadRight[d, Length[d]+p]; If[0==Mod[n, 2], AppendTo[zeroLst, d[[(Length[d]+1)/2]]]], {n, 2, nMax}]; zeroLst/2
PROG
(PARI) A083309(n, rhs=0, firstprime=2)={rhs-=prime(firstprime); my(p=vector(2*n-2+bittest(rhs, 0), i, prime(i+firstprime))); sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 10. - M. F. Hasler, Aug 08 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Apr 29 2003
STATUS
approved