OFFSET
0,5
LINKS
EXAMPLE
a(10) = 7 because we have [10], [6, 3, 1], [6, 1, 3], [3, 6, 1], [3, 1, 6], [1, 6, 3] and [1, 3, 6].
MAPLE
h:= proc(n) option remember; `if`(n<1, 0,
`if`(issqr(8*n+1), 1+h(n-1), h(n-1)))
end:
b:= proc(n, i, p) option remember; (t->
`if`(t*(i+2)/3<n, 0, `if`(n=0, p!, b(n, i-1, p)+
`if`(t>n, 0, b(n-t, i-1, p+1)))))((i*(i+1)/2))
end:
a:= n-> b(n, h(n), 0):
seq(a(n), n=0..73); # Alois P. Heinz, Jan 31 2020
MATHEMATICA
h[n_] := h[n] = If[n<1, 0, If[IntegerQ @ Sqrt[8n+1], 1 + h[n-1], h[n-1]]];
b[n_, i_, p_] := b[n, i, p] = Function[t, If[t (i + 2)/3 < n, 0, If[n == 0, p!, b[n, i-1, p] + If[t>n, 0, b[n - t, i - 1, p + 1]]]]][(i(i + 1)/2)];
a[n_] := b[n, h[n], 0];
a /@ Range[0, 73] (* Jean-François Alcover, Apr 27 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jan 29 2020
STATUS
approved