OFFSET
0,9
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..250
Wikipedia, Partition problem
EXAMPLE
a(4) = 1: 1,3,6/10.
a(5) = 1: 1,6,10/3,15.
a(6) = 1: 1,6,21/3,10,15.
a(7) = 1: 1,3,10,28/6,15,21.
a(8) = 2: 1,6,10,15,28/3,21,36; 1,10,21,28/3,6,15,36.
MAPLE
s:= proc(n) s(n):= `if`(n=0, 1, n*(n+1)/2+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))(i*(i+1)/2)))
end:
a:= n-> ceil(b(0, n)/2):
seq(a(n), n=0..45);
MATHEMATICA
s[n_] := s[n] = If[n == 0, 1, n(n+1)/2 + 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]][i(i+1)/2]]];
a[n_] := Ceiling[b[0, n]/2];
a /@ Range[0, 45] (* Jean-François Alcover, May 04 2020, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 16 2019
STATUS
approved