cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A022903 Number of solutions to c(1)*prime(4) + ... + c(n)*prime(n+3) = 0, where c(i) = +-1 for i>1, c(1) = 1.

This page as a plain text file.
%I A022903 #21 Jan 29 2024 10:51:25
%S A022903 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 A022903 75979,0,273657,0,1032161,0,3694665,0,12989200,0,48409376,0,174262116,
%U A022903 0,642786775,0,2402713235,0,8918299277,0,32868170524,0,123143998606,0
%N A022903 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 A022903 Alois P. Heinz, <a href="/A022903/b022903.txt">Table of n, a(n) for n = 1..500</a>
%F A022903 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 A022903 a(n) = [x^7] Product_{k=5..n+3} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 28 2024
%e A022903 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 A022903 := proc(n)
%p A022903     local a,b,cs,cslen ;
%p A022903     a := 0 ;
%p A022903     for b from 0 to 2^(n-1)-1 do
%p A022903         cs := convert(b,base,2) ;
%p A022903         cslen := nops(cs) ;
%p A022903         if cslen < n-1 then
%p A022903             cs := [op(cs),seq(0,i=1..n-1-cslen)] ;
%p A022903         end if;
%p A022903         if ithprime(4)+add( (-1+2*op(i-4,cs)) *ithprime(i),i=5..n+3) = 0 then
%p A022903             a := a+1 ;
%p A022903         end if;
%p A022903     end do:
%p A022903     a ;
%p A022903 end proc:
%p A022903 for n from 1 do
%p A022903     print(n,A022903(n)) ;
%p A022903 end do: # _R. J. Mathar_, Aug 06 2015
%t A022903 {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 (* A022903, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
%t A022903 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 A022903 (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 A022903 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 A022903 nonn
%O A022903 1,10
%A A022903 _Clark Kimberling_
%E A022903 a(23)-a(49) from _Alois P. Heinz_, Aug 06 2015