login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A215222
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.
2
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, 173, 170, 164, 446, 437, 1180, 1165, 1147, 1137, 1115, 1104, 2984, 2949, 2919, 2887, 7841, 7778, 21331, 21184, 21029, 20861, 57465, 57114, 56741, 56372, 55997, 55610
OFFSET
1,8
LINKS
EXAMPLE
a(5) = 1: 5 = 3+2.
a(6) = 1: 6 = 5+3-2.
a(7) = 1: 7 = 5+2.
a(8) = 2: 8 = 5+3 = 7+3-2.
a(9) = 2: 9 = 7+2 = 7+5-3.
a(10) = 3: 10 = 5+3+2 = 7+3 = 7+5-2.
a(11) = 1: 11 = 7+5-3+2.
a(12) = 5: 12 = 7+3+2 = 7+5 = 11+3-2 = 11-7+5+3 = 11+7-5-3+2.
MAPLE
sp:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1, b(n, i-1)+
b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
end:
a:= n-> b(n, numtheory[pi](n-1)):
seq(a(n), n=1..60);
MATHEMATICA
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 *)
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 06 2012
STATUS
approved