login
A113041
Number of solutions to +-p(1)+-p(2)+-...+-p(2n-1) = 2, where p(i) is the i-th prime.
4
1, 0, 1, 3, 9, 27, 78, 249, 782, 2574, 8676, 29714, 102162, 356797, 1268990, 4521769, 16134137, 58061535, 210499244, 767154326, 2809323733, 10342098153, 38281849044, 142249547127, 527095215036, 1966843667482, 7368829743507, 27636276043171, 103876045792060
OFFSET
1,4
COMMENTS
+-p(1)+-p(2)+-...+-p(2n) = 2 has no solutions, since the left hand side is odd.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..1000 (first 120 terms from Alois P. Heinz)
FORMULA
a(n) = A022896(2n-1) + A261057(n). - M. F. Hasler, Aug 09 2015
a(n) = [x^2] Product_{k=1..2*n-1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 30 2024
MAPLE
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;
# second Maple program
sp:= proc(n) sp(n):= `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
end:
a:= n-> b(2, 2*n-1):
seq(a(n), n=1..30); # Alois P. Heinz, Aug 05 2012
MATHEMATICA
sp[n_] := sp[n] = If[n == 0, 0, Prime[n] + sp[n-1]];
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]]];
a[n_] := b[2, 2n-1];
Array[a, 30] (* Jean-François Alcover, Nov 02 2020, after Alois P. Heinz *)
CROSSREFS
Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113042.
Sequence in context: A006810 A090401 A181137 * A269650 A266497 A291020
KEYWORD
nonn
AUTHOR
Floor van Lamoen, Oct 12 2005
STATUS
approved