Re: Combinatorics question
- Subject: [mg3323] Re: [mg3288] Combinatorics question
- From: moorep at MARSHALL.EDU (Phil Moore)
- Date: 26 Feb 1996 09:51:31 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
- Sender: daemon at wri.com
I believe A way to do this in Mathematica would be
biglist = {}
For[i1=1,i1<16,i1++,
For[i2=i1+1,i2<17,i2++,
For[i3=i2+1,i3<18,i3++,
For[i4=i3+1,i4<19,i4++
For[i5=i4+1,i5<20,i5++,
For[i6=i5+1,i6<21,i6++,
Append[biglist,{list[[i1]],list[[i2]],list[[i3]],list[[i4]],
list[[i5]],list[[i6]]} ] (* end of Append *)
] (* end of 6th For *)
] (* end of 5th For *)
] (* end of 4th For *)
] (* end of 3rd For *)
] (* end of 2nd For *)
] (* end of 1rst For *) (* end of command *)
Mathematica may have a much more elegant way to do this, but I
believe this will work.
Phil Moore
moorep at marshall.edu
On Fri, 23 Feb 1996 PESCC at CUNYVM.CUNY.EDU wrote:
> Can somenone help me find the following:
>
> I have a list of 20 numbers, and I would like to list all the
> combinations of these numbers taken 6 at a time. The Binomial
> function tells me there are 38760, but I would like to actually
> see all of them.
> Thanks in advance for your help.
>
>