Question: Why does Maple fail with this?

When generating the list of all the permutations of  [$1..10]  we get an error:

combinat[permute]([$ 1 .. 10]);

    Error, (in combinat:-permute) Maple was unable to allocate enough memory to complete this computation. Please see ?alloc

 

But if the same problem to solve using a simple custom procedure, there is no any problems:

restart;

Permute := proc (L::list)

local n;

n := nops(L);

if nops(L) = 1 then return [L[1 .. 1]] else

[seq(seq([op(p[1 .. k-1]), L[1], p[k .. n-1][]], k = 1 .. n), p = Permute(L[2 .. n]))] end if;

end proc:

L := CodeTools[Usage](Permute([$ 1 .. 10])):

nops(L);

        

 

 

Please Wait...