OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..100
EXAMPLE
a(5) = 5: [25], [16,4,4,1], [9,9,1,1,1,1,1,1,1], [4,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,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
s:= n-> issqr(n):
h:= proc(n) option remember; `if`(s(n), n, h(n-1)) end:
b:= proc(n, i, c) option remember; `if`(n=0 or i=1, `if`(
s(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^2$2, 0):
seq(a(n), n=0..40);
MATHEMATICA
s[n_] := IntegerQ@Sqrt[n];
h[n_] := h[n] = If[s[n], n, h[n - 1]];
b[n_, i_, c_] := b[n, i, c] = If[n == 0 || i == 1, If[s[c + n], 1, 0],
b[n - i, h[Min[n - i, i]], c + 1] + b[n, h[i - 1], c]];
a[n_] := b[n^2, n^2, 0];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jun 25 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 26 2021
STATUS
approved