0

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;
  • This looks like a homework question to me, please have a look here: https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions – Michael Heil May 04 '20 at 21:00
  • I started to wonder. So let me open this question: what is the purpose of the variable m? – Ömer Kocabıyık May 04 '20 at 21:13
  • 1
    [See the explanation for this function in the GAP tutorial](https://www.gap-system.org/Manuals/doc/tut/chap4.html#X7981E4197F7113EA) – Mike Pierce Jul 09 '20 at 14:04

0 Answers0