Very cool - I'm going to take a look at this. Thanks! And thanks to all
for the feedback.
To answer the question as to why this problem came up in the first place -
its exactly the reason that Ian mentioned. The challenge I was given was
essentially: If you knew that the next lottery ticket wo
Hi, Ken,
I recently had to build a permutation generator to generate all the unique
combinations of a set of
data where (just as in your case) order was not a factor. So given the data
set "A,B,C", I needed
to get out:
A,B,C
A,B
B,C
A,C
A
B
C
I looked at my code and was able to modify it
I'm still curious what the circumstances are that are making this pattern
necessary for Ken... if you don't mind sharing, Ken. ;o)
I have no knowledge of why Ken needs the pattern, but it is a classic pattern
for improving the odds of winning lotteries and similar entities. The idea is
that you
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)
C
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!
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]> w
I'm not sure how well this will run, but my first instinct is to do a
recursive permutation.
Basically, you write it so that the function returns a list of
permutations permute(list, length) such that
permute("1,2,3,4,5,6,7", 6)
returns a list of each of those numbers plus the permute of the
re
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,
8 matches
Mail list logo