MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Combinatorics question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3323] Re: [mg3288] Combinatorics question
  • From: Phil Moore <moorep at MARSHALL.EDU>
  • Date: Mon, 26 Feb 1996 02:56:30 -0500
  • Sender: owner-wri-mathgroup at wolfram.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.
> 
> 

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Combinatorics question
  • Next by Date: Re: Combinatorics question
  • Previous by thread: Re: Combinatorics question
  • Next by thread: Re: Combinatorics question