%I #25 Jan 30 2024 08:23:01
%S 1,0,1,3,9,27,78,249,782,2574,8676,29714,102162,356797,1268990,
%T 4521769,16134137,58061535,210499244,767154326,2809323733,10342098153,
%U 38281849044,142249547127,527095215036,1966843667482,7368829743507,27636276043171,103876045792060
%N Number of solutions to +-p(1)+-p(2)+-...+-p(2n-1) = 2, where p(i) is the i-th prime.
%C +-p(1)+-p(2)+-...+-p(2n) = 2 has no solutions, since the left hand side is odd.
%H Ray Chandler, <a href="/A113041/b113041.txt">Table of n, a(n) for n = 1..1000</a> (first 120 terms from Alois P. Heinz)
%F a(n) = A022896(2n-1) + A261057(n). - _M. F. Hasler_, Aug 09 2015
%F a(n) = [x^2] Product_{k=1..2*n-1} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 30 2024
%p A113041:=proc(n) local i,j,p,t; t:= NULL; for j to 2*n-1 by 2 do p:=1; for i to j do p:=p*(x^(-ithprime(i))+x^(ithprime(i))); od; t:=t,coeff(p,x,2); od; t; end;
%p # second Maple program
%p sp:= proc(n) sp(n):= `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
%p b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
%p b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
%p end:
%p a:= n-> b(2, 2*n-1):
%p seq(a(n), n=1..30); # _Alois P. Heinz_, Aug 05 2012
%t sp[n_] := sp[n] = If[n == 0, 0, Prime[n] + sp[n-1]];
%t b[n_, i_] := b[n, i] = If[n > sp[i], 0, If[i == 0, 1, b[n + Prime[i], i-1] + b[Abs[n - Prime[i]], i-1]]];
%t a[n_] := b[2, 2n-1];
%t Array[a, 30] (* _Jean-François Alcover_, Nov 02 2020, after _Alois P. Heinz_ *)
%Y Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113042.
%K nonn
%O 1,4
%A _Floor van Lamoen_, Oct 12 2005