home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.ibm.pc.misc
- Path: sparky!uunet!noc.near.net!vaxeline.ftp.com!AltaHopa.ftp.com!plummer
- From: plummer@vax (William W. Plummer)
- Subject: Re: 'All Possible Combinations' Algorithm
- Message-ID: <921123105513@AltaHopa.ftp.com>
- Nntp-Software: PC/TCP NNTP
- Lines: 19
- Sender: root@vaxeline.ftp.com (vaxeline.ftp.com root account)
- Nntp-Posting-Host: altahopa.ftp.com
- Reply-To: plummer@babyoil.ftp.com
- Organization: FTP Software, Inc., Wakefield, MA
- References: <By10r6.I64@apollo.hp.com>
- Date: Mon, 23 Nov 1992 10:55:13
-
- In article <By10r6.I64@apollo.hp.com> holbrook@apollo.HP.COM (Alan R. Holbrook) 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
-
- --Bill
-
- --
- William W. Plummer, N1NGK plummer@ftp.com ---> 508-659-6281
- FTP Software, Inc. 2 High Street N. Andover MA 01845
-
-
-