OFFSET
1,8
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 06 2012
STATUS
approved