0
$\begingroup$

I have a list such as : {1,3,6}, then, I want to get all the orders of it, I do not know which function is easier. I have to try this code, but it is complex.

a={1,3,6};
b=Table[0,6];
b[[1]]=a;
b[[2]]={a[[2]],a[[3]],a[[1]]};
b[[3]]={a[[1]],a[[3]],a[[2]]};
b[[4]]={a[[2]],a[[1]],a[[3]]};
b[[5]]={a[[3]],a[[1]],a[[2]]};

Such that. I want to get a simple code for this.

$\endgroup$
3
$\begingroup$

There is a function for that...

Permutations[a]

https://reference.wolfram.com/language/ref/Permutations.html?q=Permutations

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.