OFFSET
0,7
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
Wikipedia, Partition problem
EXAMPLE
a(8) = 6: 2,17,19/3,5,7,11,13; 3,5,11,19/2,7,13,17; 3,5,13,17/2,7,11,19; 3,7,11,17/2,5,13,19; 2,3,5,11,17/7,13,19; 2,5,7,11,13/3,17,19.
a(9) = 5: 2,3,5,17,23/7,11,13,19; 2,5,7,13,23/3,11,17,19; 2,5,7,17,19/3,11,13,23; 2,5,11,13,19/3,7,17,23; 2,7,11,13,17/3,5,19,23.
MAPLE
s:= proc(n) s(n):= `if`(n=0, 1, ithprime(n)+s(n-1)) end:
b:= proc(n, i) option remember; `if`(i=0, `if`(n<=1, 1, 0),
`if`(n>s(i), 0, (p->b(n+p, i-1)+b(abs(n-p), i-1))(ithprime(i))))
end:
a:= n-> ceil(b(0, n)/2):
seq(a(n), n=0..45);
MATHEMATICA
s[n_] := s[n] = If[n == 0, 1, Prime[n] + s[n - 1]];
b[n_, i_] := b[n, i] = If[i==0, If[n <= 1, 1, 0], If[n > s[i], 0, Function[ p, b[n + p, i - 1] + b[Abs[n - p], i - 1]][Prime[i]]]];
a[n_] := Ceiling[b[0, n]/2];
a /@ Range[0, 45] (* Jean-François Alcover, Apr 30 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 31 2019
STATUS
approved