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.

A215221 Number of solutions to p(n) = Sum_{i=1..n-1} c(i)*p(i) with c(i) in {-1,0,1} and p(n) = n-th prime.

This page as a plain text file.
%I A215221 #18 Dec 06 2014 21:55:09
%S A215221 0,0,1,1,1,5,11,28,69,164,437,1104,2887,7778,20861,55610,148857,
%T A215221 408694,1112103,3059571,8519916,23586160,65766961,183122954,508287720,
%U A215221 1423807763,4019399991,11359914488,32294035715,91866217942,258134484981,732226048291
%N A215221 Number of solutions to p(n) = Sum_{i=1..n-1} c(i)*p(i) with c(i) in {-1,0,1} and p(n) = n-th prime.
%H A215221 Alois P. Heinz and Ray Chandler, <a href="/A215221/b215221.txt">Table of n, a(n) for n = 1..1000</a> (first 200 terms from Alois P. Heinz)
%F A215221 a(n) = A215222(A000040(n)).
%e A215221 a(3) = 1: prime(3) = 5 = 3+2.
%e A215221 a(4) = 1: prime(4) = 7 = 5+2.
%e A215221 a(5) = 1: prime(5) = 11 = 7+5-3+2.
%e A215221 a(6) = 5: prime(6) = 13 = 7+5+3-2 = 11+2 = 11+5-3 = 11+7-3-2 = 11+7-5.
%e A215221 a(7) = 11: prime(7) = 17 = 7+5+3+2 = 11+5+3-2 = 11+7-3+2 = 13+5-3+2 = 13+7-3 = 13+7-5+2 = 13-11+7+5+3 = 13+11-5-2 = 13+11-7 = 13+11-7-5+3+2 = 13+11-7+5-3-2.
%p A215221 sp:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
%p A215221 b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
%p A215221         b(n, i-1)+ b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
%p A215221      end:
%p A215221 a:= n-> b(ithprime(n), n-1):
%p A215221 seq(a(n), n=1..40);
%t A215221 nmax = 40; d = {1}; a1 = {};
%t A215221 Do[
%t A215221   p = Prime[n];
%t A215221   i = Ceiling[Length[d]/2] + p;
%t A215221   AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
%t A215221   d = PadLeft[d, Length[d] + 2 p] + PadRight[d, Length[d] + 2 p] +
%t A215221     PadLeft[PadRight[d, Length[d] + p], Length[d] + 2 p];
%t A215221   , {n, nmax}];
%t A215221 a1 (* _Ray Chandler_, Mar 11 2014 *)
%Y A215221 Cf. A000040, A007504, A022894, A083309, A113040, A215222.
%K A215221 nonn
%O A215221 1,6
%A A215221 _Alois P. Heinz_, Aug 06 2012