Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Permutations/Maple/permutations-2.maple
Normal file
5
Task/Permutations/Maple/permutations-2.maple
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fold:=(f,a,v)->`if`(nops(v)=0,a,fold(f,f(a,op(1,v)),[op(2...,v)])):
|
||||
insert:=(v,a,n)->`if`(n>nops(v),[op(v),a],subsop(n=(a,v[n]),v)):
|
||||
perm:=s->fold((a,b)->map(u->seq(insert(u,b,k+1),k=0..nops(u)),a),[[]],s):
|
||||
perm([$1..3]);
|
||||
[[3, 2, 1], [2, 3, 1], [2, 1, 3], [3, 1, 2], [1, 3, 2], [1, 2, 3]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue