The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A022896 Number of solutions to c(1)*prime(1) + ... + c(n)*prime(n) = 2, where c(i) = +-1 for i > 1, c(1) = 1. 9

%I #21 Jan 27 2024 20:26:27

%S 1,0,0,0,0,0,2,0,4,0,14,0,38,0,126,0,394,0,1290,0,4344,0,14846,0,

%T 51068,0,178436,0,634568,0,2261052,0,8067296,0,29031484,0,105251904,0,

%U 383580180,0,1404666680,0,5171079172,0,19141098744,0,71125205900,0,263549059326

%N Number of solutions to c(1)*prime(1) + ... + c(n)*prime(n) = 2, where c(i) = +-1 for i > 1, c(1) = 1.

%H Alois P. Heinz, <a href="/A022896/b022896.txt">Table of n, a(n) for n = 1..500</a>

%F a(2n-1) = A113041(n) - A261057(n), a(2n) = 0 because there is an odd number of odd terms on the left hand side, but the right hand side is even. - _M. F. Hasler_, Aug 09 2015

%F a(n) = [x^0] Product_{k=2..n} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 26 2024

%e a(7) counts these 2 solutions: {2, -3, -5, -7, 11, -13, 17}, {2, 3, 5, 7, -11, 13, -17}.

%t {f, s} = {1, 2}; 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 (* A022896, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)

%t 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 2 solutions of using n=7 primes; _Peter J. C. Moses_, Oct 01 2013 *)

%o (PARI) A022896(n, rhs=2, firstprime=1)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); !(rhs||#p)+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

%o (PARI) a(n,s=2-prime(1),p=1)={if(n<=s,if(s==p,n==s,a(abs(n-p),s-p,precprime(p-1))+a(n+p,s-p,precprime(p-1))),if(s<=0,if(n>1,a(abs(s),sum(i=p+1,p+n-1,prime(i)),prime(p+n-1)),!s)))} \\ _M. F. Hasler_, Aug 09 2015

%Y Cf. A022894 (r.h.s. = 0), A022895 (r.h.s. = 1), A022897, ..., A022904, A022920 (using primes >= 7), A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113041, A113042. - _M. F. Hasler_, Aug 08 2015

%K nonn

%O 1,7

%A _Clark Kimberling_

%E Corrected and extended by _Clark Kimberling_, Oct 01 2013

%E a(23)-a(49) from _Alois P. Heinz_, Aug 06 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 31 22:12 EDT 2024. Contains 373007 sequences. (Running on oeis4.)