OFFSET
1,7
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..500
FORMULA
a(n) = [x^6] Product_{k=5..n+3} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 30 2024
EXAMPLE
a(7) counts these 3 solutions: {7, -11, 13, 17, -19, 23, -29}, {7, 11, -13, -17, 19, 23, -29}, {7, 11, 13, -17, -19, -23, 29}.
MAPLE
A022904 := proc(n)
local a, b, cs, cslen ;
a := 0 ;
for b from 0 to 2^(n-1)-1 do
cs := convert(b, base, 2) ;
cslen := nops(cs) ;
if cslen < n-1 then
cs := [op(cs), seq(0, i=1..n-1-cslen)] ;
end if;
if ithprime(4)+add( (-1+2*op(i-4, cs)) *ithprime(i), i=5..n+3) = 1 then
a := a+1 ;
end if;
end do:
a ;
end proc: # R. J. Mathar, Aug 06 2015
MATHEMATICA
{f, s} = {4, 1}; 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}]
(* A022904, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
n = 7; 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 3 solutions of using n=7 primes; Peter J. C. Moses, Oct 01 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected and extended by Clark Kimberling, Oct 01 2013
a(23)-a(50) from Alois P. Heinz, Aug 06 2015
STATUS
approved