🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.misc
Article #10592

Re: 'All Possible Combinations' Algorithm

#10592
From: William W. Plummer
Date: Mon, 23 Nov 1992 10:55
18 lines
1105 bytes
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
Technical Details
Message-ID: <921123105513@AltaHopa.ftp.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!vaxeline.ftp.com!AltaHopa.ftp.com!plummer
References: <By10r6.I64@apollo.hp.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.ibm.pc.misc
Path: arc1-ca.pugleaf.net!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