OFFSET
1,10
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..500
FORMULA
a(n) = [x^5] Product_{k=4..n+2} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 28 2024
EXAMPLE
a(8) counts the unique solution {5, -7, 11, -13, 17, -19, -23, 29}.
MATHEMATICA
{f, s} = {3, 0}; Table[t = Map[Prime[# + f - 1] &, Range[2, z]]; Count[Map[Apply[Plus, #] &, Map[t # &, Tuples[{-1, 1}, Length[t]]]], s - Prime[f]], {z, 22}]
(* A022900, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
n = 8; t = Map[Prime[# + f - 1] &, Range[n]]; Map[#[[2]] &, Select[Map[{Apply[Plus, #], #} &, Map[t # &, Map[Prepend[#, 1] &, Tuples[{-1, 1}, Length[t] - 1]]]], #[[1]] == s &]] (* the unique solution of using n=8 primes; Peter J. C. Moses, Oct 01 2013 *)
PROG
(PARI) A022900(n, rhs=0, firstprime=3)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); sum(i=1, 2^(n-1), sum(j=1, #p, (1-bittest(i, j-1)<<1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 20. - M. F. Hasler, Aug 08 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected and extended by Clark Kimberling, Oct 01 2013
a(23)-a(49) from Alois P. Heinz, Aug 06 2015
Missing cross-references added by M. F. Hasler, Aug 08 2015
STATUS
approved