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.

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

This page as a plain text file.
%I A022904 #20 Jan 30 2024 08:22:53
%S A022904 0,0,0,0,0,0,3,0,1,0,6,0,32,0,110,0,252,0,1139,0,3127,0,12743,0,39767,
%T A022904 0,156376,0,517381,0,1870169,0,6786580,0,25420402,0,90815872,0,
%U A022904 334621081,0,1235976769,0,4597232973,0,17047065235,0,63450750049,0,238163814619,0
%N A022904 Number of solutions to c(1)*prime(4) + ... + c(n)*prime(n+3) = 1, where c(i) = +-1 for i>1, c(1) = 1.
%H A022904 Alois P. Heinz, <a href="/A022904/b022904.txt">Table of n, a(n) for n = 1..500</a>
%F A022904 a(n) = [x^6] Product_{k=5..n+3} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 30 2024
%e A022904 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}.
%p A022904 A022904 := proc(n)
%p A022904     local a,b,cs,cslen ;
%p A022904     a := 0 ;
%p A022904     for b from 0 to 2^(n-1)-1 do
%p A022904         cs := convert(b,base,2) ;
%p A022904         cslen := nops(cs) ;
%p A022904         if cslen < n-1 then
%p A022904             cs := [op(cs),seq(0,i=1..n-1-cslen)] ;
%p A022904         end if;
%p A022904         if ithprime(4)+add( (-1+2*op(i-4,cs)) *ithprime(i),i=5..n+3) = 1 then
%p A022904             a := a+1 ;
%p A022904         end if;
%p A022904     end do:
%p A022904     a ;
%p A022904 end proc: # _R. J. Mathar_, Aug 06 2015
%t A022904 {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}]
%t A022904 (* A022904, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
%t A022904 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 *)
%Y A022904 Cf. A022903, A022920.
%K A022904 nonn
%O A022904 1,7
%A A022904 _Clark Kimberling_
%E A022904 Corrected and extended by _Clark Kimberling_, Oct 01 2013
%E A022904 a(23)-a(50) from _Alois P. Heinz_, Aug 06 2015