How are recursive partition numbers found step by step on the program?

54 Views Asked by At

The "recursive partition numbers" code written using GAP 4.10.2 are as follows. For example, could you explain the working steps of the GAP programming for nrparts(15)? How did we get nrparts (15) = 176 step by step in the program?

nrparts:= function(n)
local np;

np := function(n, m)
local i, res;
if n = 0 then
  return 1;
fi;
res:= 0;
for i in [1..Minimum(n,m)] do
  res:= res + np(n-i, i);
od;
return res;
end;

return np(n,n);

end;
0

There are 0 best solutions below