OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..141
EXAMPLE
a(5) = 6: [15], [10,1,1,1,1,1], [6,6,3], [6,3,3,1,1,1], [6,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1].
MAPLE
t:= n-> issqr(8*n+1):
h:= proc(n) option remember; `if`(t(n), n, h(n-1)) end:
b:= proc(n, i, c) option remember; `if`(n=0 or i=1, `if`(
t(c+n), 1, 0), b(n-i, h(min(n-i, i)), c+1)+b(n, h(i-1), c))
end:
a:= n-> b(n*(n+1)/2$2, 0):
seq(a(n), n=0..40);
MATHEMATICA
t[n_] := IntegerQ@Sqrt[8n+1];
h[n_] := h[n] = If[t[n], n, h[n-1]];
b[n_, i_, c_] := b[n, i, c] = If[n == 0 || i == 1, If[t[c+n], 1, 0], b[n-i, h[Min[n-i, i]], c+1] + b[n, h[i-1], c]];
a[n_] := b[n(n+1)/2, n(n+1)/2, 0];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jan 10 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 26 2021
STATUS
approved