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.

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

This page as a plain text file.
%I A261059 #18 Jan 31 2024 11:42:56
%S A261059 1,0,2,1,4,25,47,237,562,1965,7960,24148,85579,307569,1104519,4106381,
%T A261059 14710760,52113647,193181449,698356631,2574590311,9600573372,
%U A261059 35644252223,131545038705,492346772797,1843993274342,6903884199622,25984680496124,97937400336407
%N A261059 Number of solutions to c(1)*prime(2)+...+c(2n)*prime(2n+1) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
%C A261059 There cannot be a solution for an odd number of terms on the l.h.s. because all terms are odd but the r.h.s. is even.
%H A261059 Alois P. Heinz, <a href="/A261059/b261059.txt">Table of n, a(n) for n = 1..300</a>
%F A261059 a(n) = [x^5] Product_{k=3..2*n+1} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 31 2024
%e A261059 a(1) = 1 because prime(2) - prime(3) = -2.
%e A261059 a(2) = 0 because prime(2) +- prime(3) +- prime(4) +- prime(5) is different from -2 for any choice of the signs.
%e A261059 a(3) = 2 counts the 2 solutions prime(2) - prime(3) + prime(4) - prime(5) - prime(6) + prime(7) = -2 and prime(2) - prime(3) - prime(4) + prime(5) + prime(6) - prime(7) = -2.
%p A261059 s:= proc(n) option remember;
%p A261059       `if`(n<3, 0, ithprime(n)+s(n-1))
%p A261059     end:
%p A261059 b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=2, 1,
%p A261059       b(abs(n-ithprime(i)),i-1)+b(n+ithprime(i),i-1)))
%p A261059     end:
%p A261059 a:= n-> b(5, 2*n+1):
%p A261059 seq(a(n), n=1..30);  # _Alois P. Heinz_, Aug 08 2015
%t A261059 s[n_] := s[n] = If[n<3, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 2, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]];  a[n_] := b[5, 2*n+1]; Table[a[n], {n, 1, 30}] (* _Jean-François Alcover_, Nov 11 2015, after _Alois P. Heinz_ *)
%o A261059 (PARI) A261059(n,rhs=-2,firstprime=2)={rhs-=prime(firstprime);my(p=vector(2*n-2+bittest(rhs,0),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 >> 10.
%o A261059 (PARI) a(n,s=-2-3,p=2)=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,a(abs(s),sum(i=p+1,p+2*n-1,prime(i)),prime(p+n*2-1))))
%Y A261059 Cf. A261057 (starting with prime(1)), A261060 (starting with prime(3)), A261045 (starting with prime(4)), A261061 - A261063 and A261044 (r.h.s. = -1), A022894 - A022904, A083309, A022920 (r.h.s. = 0, 1 or 2), .
%K A261059 nonn
%O A261059 1,3
%A A261059 _M. F. Hasler_, Aug 08 2015
%E A261059 a(15)-a(29) from _Alois P. Heinz_, Aug 08 2015