Thanks Ben! I didn't know about that "x choose y" deal (I'm not a huge math
guy, just better than the average bear ;o) I love it when I can learn
something new. :o)

I'm still curious what the circumstances are that are making this pattern
necessary for Ken... if you don't mind sharing, Ken. ;o)

Chris


On 9/25/07, Ben Doom <[EMAIL PROTECTED]> wrote:
>
> Technically, he's asking for a combination, which would be
> (x choose y)
> which is
> x!/y!(x-y)! (number of combinations)
> instead of
> x!/(x-y)! (number of permutations, in which order counts)
>
> So if there are 7 numbers in the original list, and you need 6 of them,
> it's
> 7!/6!(7-6)! = 7!/6! * 1! = 7!/6! = 7
> for 7 numbers, choose 5
> 7 choose 5 = 7!/5!(7-5)! = 7!/5!*2! = 7 * 6 / 2 = 7 * 3 = 21
>
> Hopefully, that made some sense.
>
> I missed that part in my original post.
>
> --Ben Doom
>
> Christopher Jordan wrote:
> > I'm curious why in your case 1,2,3,4,5,6 is considered to be the same as
> > 1,2,3,4,6,5?  I was going to suggest that you use n! to figure out how
> many
> > possible permutations of the string there were, but that wouldn't work
> given
> > your requirements.
> >
> > Chris
> >
> >
> > On 9/25/07, Ken Fassman <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >> I have a problem I'm struggling to solve in ColdFusion - I wonder if
> >> someone
> >> can help me with.
> >>
> >> I am being given a variable length, numeric string (min 6, max 20).  I
> >> need
> >> to show all combinations of those values that will result in a unique
> set
> >> of
> >> 6.  The resulting output is sorted - so 1,2,3,4,5,6 is the same as
> >> 1,2,3,4,6,5.
> >>
> >> I'd also like to see if there is an easy way to calculate the expected
> >> number of each in advance.
> >>
> >> Just to illustrate what I'm looking to do (in case its not clear from
> >> above):
> >>
> >> The input string might be "1,2,3,4,5,6,7" and I'd need to return the
> >> following results:
> >> 123456
> >> 123457
> >> 123467
> >> 123567
> >> 124567
> >> 134567
> >> 234567
> >>
> >>
> >> Any thoughts on this on how to approach this are greatly appreciated.
> >>
> >> Thanks!
> >>
> >> - KsF
> >>
> >>
> >>
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289482
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to