To find the number of combinations of quantity quantity R, in N number of items:
N! / R!(N-R)! Keep in mind that in a combination, order does not matter. Make sure that is what you want, instead of a permutation, where order is considered. I don't know if CF has a factorial function, but one would be very easy to write. On Wed, Apr 16, 2008 at 10:32 AM, Ian Skinner <[EMAIL PROTECTED]> wrote: > What is the formula to calculate the number of combinations of size x > [no repeats] that exist in a set of size y? > > I.E. > Set Y : 1,2,3,4,5 = 10 unique combinations of 3 [1,2,3 1,2,4 ... 3,4,5] > Set Y : 1,2,3,4,5,6 = 20 unique combinations of 3 [1,2,3 1,2,4 ... 4,5,6] > Set Y : 1,2,3,4,5,6 = 15 unique combinations of 4 [1,2,3,4 1,2,3,5 ... > 3,4,5,6] > > I can figure these out by brute force looping but it would be nice if I > could do this with a straight forward formula in my CFML. But (a) I can > not recall the formula and (b) I am not sure if I can express the > formula in ColdFusion. > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:258582 Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5