Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Jan 29 2024 10:51:25
%S 0,0,0,1,0,0,0,0,0,6,0,9,0,61,0,131,0,486,0,2029,0,5890,0,21127,0,
%T 75979,0,273657,0,1032161,0,3694665,0,12989200,0,48409376,0,174262116,
%U 0,642786775,0,2402713235,0,8918299277,0,32868170524,0,123143998606,0
%N Number of solutions to c(1)*prime(4) + ... + c(n)*prime(n+3) = 0, where c(i) = +-1 for i>1, c(1) = 1.
%H Alois P. Heinz, <a href="/A022903/b022903.txt">Table of n, a(n) for n = 1..500</a>
%F a(2n-1) = 0 for all n >= 1 because an odd number of odd terms on the l.h.s. cannot sum to zero. - _M. F. Hasler_, Aug 08 2015
%F a(n) = [x^7] Product_{k=5..n+3} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 28 2024
%e a(10) counts these 6 solutions: {7, -11, -13, -17, -19, -23, 29, -31, 37, 41}, {7, 11, -13, 17, 19, -23, 29, 31, -37, -41}, {7, 11, -13, 17, 19, 23, -29, -31, 37, -41}, {7, 11, 13, -17, -19, 23, 29, 31, -37, -41}, {7, 11, 13, -17, 19, 23, -29, -31, -37, 41}, {7, 11, 13, 17, -19, -23, 29, -31, 37, -41}.
%p A022903 := proc(n)
%p local a,b,cs,cslen ;
%p a := 0 ;
%p for b from 0 to 2^(n-1)-1 do
%p cs := convert(b,base,2) ;
%p cslen := nops(cs) ;
%p if cslen < n-1 then
%p cs := [op(cs),seq(0,i=1..n-1-cslen)] ;
%p end if;
%p if ithprime(4)+add( (-1+2*op(i-4,cs)) *ithprime(i),i=5..n+3) = 0 then
%p a := a+1 ;
%p end if;
%p end do:
%p a ;
%p end proc:
%p for n from 1 do
%p print(n,A022903(n)) ;
%p end do: # _R. J. Mathar_, Aug 06 2015
%t {f, s} = {4, 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}]
%t (* A022903, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
%t n = 10; 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 6 solutions of using n=10 primes; _Peter J. C. Moses_, Oct 01 2013 *)
%o (PARI) A022903(n, rhs=0, firstprime=4)={rhs-=prime(firstprime); my(p=vector(n-1, 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 >> 20. - M. F. Hasler, Aug 08 2015
%Y Cf. A022894, A022895, ..., A022904, A083309, A022920 (variants with r.h.s. in {0, 1 or 2}, starting with prime(1), prime(2), prime(3) or prime(4)); A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060, A261045(r.h.s. = -2).
%K nonn
%O 1,10
%A _Clark Kimberling_
%E a(23)-a(49) from _Alois P. Heinz_, Aug 06 2015