Article View: comp.sys.ibm.pc.misc
Article #10595Re: 'All Possible Combinations' Algorithm
From: Stefano Pagiola
Date: Mon, 23 Nov 1992 16:43
Date: Mon, 23 Nov 1992 16:43
22 lines
1156 bytes
1156 bytes
William W. Plummer writes >> Can someone provide me with an algorithm suitable for writing >> a program to dump all possible combinations of 'n' elements >> taken 'm' at a time? > > n!/(m! * (n-m)!) > > For instance in the MA Megabucks with 6 numbers out of 36 we have > > 36!(6! * 30!) = 36*35*34*33*32*31/(6*5*4*3*2*1) > = 6*7*34*11*4*31 > = 1,947,792 Methinks the original poster wanted to _list_ all possible combinations, not just calculate how many there are... -- - Stefano Pagiola Food Research Institute, Stanford University spagiola@frinext.stanford.edu (NeXTMail encouraged) spagiola@FRI-nxt-Pagiola.stanford.edu (NeXTMail encouraged)
Technical Details
Message-ID:
<1992Nov23.164311.27333@leland.Stanford.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!leland.Stanford.EDU!newsReferences:
<921123105513@AltaHopa.ftp.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.ibm.pc.misc Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!leland.Stanford.EDU!news From: spagiola@frinext.stanford.edu (Stefano Pagiola) Subject: Re: 'All Possible Combinations' Algorithm Message-ID: <1992Nov23.164311.27333@leland.Stanford.EDU> Sender: news@leland.Stanford.EDU (Mr News) Reply-To: spagiola@frinext.stanford.edu Organization: DSO, Stanford University References: <921123105513@AltaHopa.ftp.com> Date: Mon, 23 Nov 92 16:43:11 GMT Lines: 22