Re: Combination List
- To: mathgroup at smc.vnet.net
- Subject: [mg77882] Re: Combination List
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 19 Jun 2007 06:33:03 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f55qci$k58$1@smc.vnet.net>
Bruno Campanini wrote: > I know combinations of 4 elements taken 3 by 3 is 4, > that is Binomial[4,3] = 4 > How can I get the list: > 1 2 3 > 1 2 4 > 1 3 4 > 1 4 2 --^^^^^ I believe the last line is a typo (otherwise your request does not make any sense). > The same way I get permuations list from Permutations[{...}] > ??? > > Bruno > What you are looking for is the list of all subsets of exactly 3 elements. The built in function *Subsets* with its second argument set to {3} will do what you want. In[1]:= lst = {1, 2, 3, 4}; Subsets[lst, {3}] Out[2]= {{1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}} Regards, Jean-Marc