login
a(n) is the number of times that sums 3 +- 5 +- 7 +- 11 +- ... +- prime(2n+1) of the first 2n odd primes is zero. There are 2^(2n-1) choices for the sign patterns.
27

%I #25 Nov 02 2023 02:04:01

%S 0,0,1,2,7,19,63,197,645,2172,7423,25534,89218,317284,1130526,4033648,

%T 14515742,52625952,191790090,702333340,2585539586,9570549372,

%U 35562602950,131774529663,491713178890,1842214901398,6909091641548

%N a(n) is the number of times that sums 3 +- 5 +- 7 +- 11 +- ... +- prime(2n+1) of the first 2n odd primes is zero. There are 2^(2n-1) choices for the sign patterns.

%C 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.

%C a(n) is the maximal number of subsets of {prime(2), prime(3), ..., prime(n+1)} that share the same sum. Cf. A025591, A083527.

%C See A238894 for a more general sequence that looks at all sums formed. - _T. D. Noe_, Mar 07 2014

%H Ray Chandler, <a href="/A083309/b083309.txt">Table of n, a(n) for n = 1..1000</a> (first 100 terms from T. D. Noe)

%H T. D. Noe, <a href="http://www.sspectra.com/math/Sums.html">Extremal Sums of Sequences</a>.

%F a(n) = A022897(2n). - _M. F. Hasler_, Aug 08 2015

%e 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.

%t 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

%o (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

%Y Cf. A015818, A063865, A238894.

%Y Cf. A022894 (use all primes in the sum), A022895 (r.h.s. = 1), A022896 (r.h.s. = 2), A022897 (interleaved 0 for odd number of terms), ..., A022903 (using primes >= 7), A022904, A022920; A261061 - A261063 and A261044 (r.h.s. = -1); A261057, A261059, A261060, A261045 (r.h.s. = -2).

%K nonn

%O 1,4

%A _T. D. Noe_, Apr 29 2003