Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #17 Jun 04 2019 19:07:11
%S 0,0,0,0,1,1,1,2,2,3,1,5,5,13,12,11,11,29,28,74,73,71,69,184,182,176,
%T 173,170,164,446,437,1180,1165,1147,1137,1115,1104,2984,2949,2919,
%U 2887,7841,7778,21331,21184,21029,20861,57465,57114,56741,56372,55997,55610
%N Number of solutions to n = Sum_{i=1..pi(n-1)} c(i)*p(i) with c(i) in {-1,0,1}, p(n) = n-th prime and pi = A000720.
%H Alois P. Heinz, <a href="/A215222/b215222.txt">Table of n, a(n) for n = 1..1000</a>
%e a(5) = 1: 5 = 3+2.
%e a(6) = 1: 6 = 5+3-2.
%e a(7) = 1: 7 = 5+2.
%e a(8) = 2: 8 = 5+3 = 7+3-2.
%e a(9) = 2: 9 = 7+2 = 7+5-3.
%e a(10) = 3: 10 = 5+3+2 = 7+3 = 7+5-2.
%e a(11) = 1: 11 = 7+5-3+2.
%e a(12) = 5: 12 = 7+3+2 = 7+5 = 11+3-2 = 11-7+5+3 = 11+7-5-3+2.
%p sp:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
%p b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1, b(n, i-1)+
%p b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
%p end:
%p a:= n-> b(n, numtheory[pi](n-1)):
%p seq(a(n), n=1..60);
%t sp[n_] := sp[n] = If[n == 0, 0, Prime[n]+sp[n-1]]; b[n_, i_] := b[n, i] = If[n>sp[i], 0, If[i == 0, 1, b[n, i-1] + b[n+Prime[i], i-1] + b[Abs[n-Prime[i]], i-1]]]; a[n_] := b[n, PrimePi[n-1]]; Table[a[n], {n, 1, 60}] (* _Jean-François Alcover_, Dec 03 2014, after _Alois P. Heinz_ *)
%Y Cf. A000040, A000720, A007504, A022894, A083309, A113040, A215221.
%K nonn
%O 1,8
%A _Alois P. Heinz_, Aug 06 2012