About list Permutation
Hi,
I have a question, I try 2 days but do nothing.
I have a list: 1 2 3 4 5 6 7 8 9 , I want get all possibility permutation as 6 numbers, like this:
1 2 3 4 5 6
1 3 4 5 6 7
1 4 5 6 7 8
1 5 6 7 8 9
1 2 4 5 6 7
1 2 5 6 7 8
1 2 6 7 8 9
etc....
thanks.
Have you tried [mxj list.Permutation]?
Thank you for your reply. :)
I tried list.Permutation, I get list from it:
1 2 3 4 5 6
2 1 3 4 5 6
3 2 1 4 5 6
4 2 3 1 5 6
5 2 3 4 1 6
6 2 3 4 5 1
etc...
The 6 lists have same element, just different order. For me , the 6 list is ONE list.
I don't care order.
Any good idea ?
I don't understand your question then. The list.Permutation will create all 6 number list variations from the 9 numbers input. Here are the first 19 runs of list.Permutation with 9 numbers input and the last three sliced off to create 6 output
1 2 3 4 5 6
2 1 3 4 5 6
3 2 1 4 5 6
4 2 3 1 5 6
5 2 3 4 1 6
6 2 3 4 5 1
7 2 3 4 5 6
8 2 3 4 5 6
9 2 3 4 5 6
1 3 2 4 5 6
2 3 1 4 5 6
3 1 2 4 5 6
4 3 2 1 5 6
5 3 2 4 1 6
6 3 2 4 5 1
7 3 2 4 5 6
8 3 2 4 5 6
9 3 2 4 5 6
1 4 3 2 5 6
Hi.
@Baixm: it seems to me that you don't need permutations, but 6-combinations of your original list.
http://en.wikipedia.org/wiki/Permutation
http://en.wikipedia.org/wiki/Combination
You might want to have a look at the bach package ( www.bachproject.net ), which -- among lots of other stuff -- includes a bach.comb object.
hth
aa
I did not articulate my question,I tried bach, very useful, yeah! Thank you! @ANDREA AGOSTINI @RICK
It works will. : )