login
A261060
Number of solutions to c(1)*prime(3) + ... + c(2n)*prime(2n+2) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
18
1, 0, 2, 1, 9, 22, 38, 143, 676, 1815, 7434, 22452, 87485, 290873, 1092072, 3894381, 13988849, 49672279, 184745525, 677809709, 2495632892, 9260315018, 34280441347, 127419049587, 474867366809, 1781565475308, 6700749901259, 25230023849115, 95215110677472
OFFSET
1,3
COMMENTS
There cannot be a solution for an odd number of terms on the l.h.s. because all terms are odd but the r.h.s. is even.
LINKS
FORMULA
a(n) = [x^7] Product_{k=4..2*n+2} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = 1 because prime(3) - prime(4) = -2.
a(2) = 0 because prime(3) +- prime(4) +- prime(5) +- prime(6) is different from -2 for any choice of the signs.
a(3) = 2 counts the two solutions prime(3) - prime(4) + prime(5) - prime(6) - prime(7) + prime(8) = 5 - 7 + 11 - 13 - 17 + 19 = -2 and prime(3) - prime(4) - prime(5) + prime(6) + prime(7) - prime(8) = 5 - 7 - 11 + 13 + 17 - 19 = -2.
MAPLE
s:= proc(n) option remember;
`if`(n<4, 0, ithprime(n)+s(n-1))
end:
b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=3, 1,
b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
end:
a:= n-> b(7, 2*n+2):
seq(a(n), n=1..30); # Alois P. Heinz, Aug 08 2015
MATHEMATICA
s[n_] := s[n] = If[n<4, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 3, 1, b[Abs[n-Prime[i]], i-1]+b[n+Prime[i], i-1]]]; a[n_] := b[7, 2*n+2]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) a(n, rhs=-2, firstprime=3)={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.
CROSSREFS
Cf. A261057, A261059 and A261045 (starting with prime(1), prime(2) and prime(4)), A261061 - A261063 and A261044 (r.h.s. = -1), A022894 - A022904, A083309, A022920 (r.h.s. = 0, 1 or 2).
Sequence in context: A178075 A221756 A094633 * A144244 A079582 A259872
KEYWORD
nonn
AUTHOR
M. F. Hasler, Aug 08 2015
EXTENSIONS
a(14)-a(29) from Alois P. Heinz, Aug 08 2015
STATUS
approved