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.

A113041 Number of solutions to +-p(1)+-p(2)+-...+-p(2n-1) = 2, where p(i) is the i-th prime.

This page as a plain text file.
%I A113041 #25 Jan 30 2024 08:23:01
%S A113041 1,0,1,3,9,27,78,249,782,2574,8676,29714,102162,356797,1268990,
%T A113041 4521769,16134137,58061535,210499244,767154326,2809323733,10342098153,
%U A113041 38281849044,142249547127,527095215036,1966843667482,7368829743507,27636276043171,103876045792060
%N A113041 Number of solutions to +-p(1)+-p(2)+-...+-p(2n-1) = 2, where p(i) is the i-th prime.
%C A113041 +-p(1)+-p(2)+-...+-p(2n) = 2 has no solutions, since the left hand side is odd.
%H A113041 Ray Chandler, <a href="/A113041/b113041.txt">Table of n, a(n) for n = 1..1000</a> (first 120 terms from Alois P. Heinz)
%F A113041 a(n) = A022896(2n-1) + A261057(n). - _M. F. Hasler_, Aug 09 2015
%F A113041 a(n) = [x^2] Product_{k=1..2*n-1} (x^prime(k) + 1/x^prime(k)). - _Ilya Gutkovskiy_, Jan 30 2024
%p A113041 A113041:=proc(n) local i,j,p,t; t:= NULL; for j to 2*n-1 by 2 do p:=1; for i to j do p:=p*(x^(-ithprime(i))+x^(ithprime(i))); od; t:=t,coeff(p,x,2); od; t; end;
%p A113041 # second Maple program
%p A113041 sp:= proc(n) sp(n):= `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
%p A113041 b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
%p A113041         b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
%p A113041      end:
%p A113041 a:= n-> b(2, 2*n-1):
%p A113041 seq(a(n), n=1..30);  # _Alois P. Heinz_, Aug 05 2012
%t A113041 sp[n_] := sp[n] = If[n == 0, 0, Prime[n] + sp[n-1]];
%t A113041 b[n_, i_] := b[n, i] = If[n > sp[i], 0, If[i == 0, 1, b[n + Prime[i], i-1] + b[Abs[n - Prime[i]], i-1]]];
%t A113041 a[n_] := b[2, 2n-1];
%t A113041 Array[a, 30] (* _Jean-François Alcover_, Nov 02 2020, after _Alois P. Heinz_ *)
%Y A113041 Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113042.
%K A113041 nonn
%O A113041 1,4
%A A113041 _Floor van Lamoen_, Oct 12 2005