>yep, I missed that part.
>
>On Apr 16, 2008, at 10:58 AM, Ian Skinner wrote:
>
>>
While digging around for some ruby articles, I came across this function:
def subn(n, list)
return [[]] if n == 0
return [] if list.empty?
remainder = list[1..-1]
subn(n-1, remainder).collect {|it|
Math rocksand so does this list.
On Wed, Apr 16, 2008 at 11:07 AM, Ian Skinner <[EMAIL PROTECTED]> wrote:
> James Smith wrote:
> >> I don't know if CF has a factorial function, but one would be very
> easy to
> >> write.
> >>
> >
> > function Factorial(integer){
> > Var TheFactorial=1;
>
James Smith wrote:
>> I don't know if CF has a factorial function, but one would be very easy to
>> write.
>>
>
> function Factorial(integer){
> Var TheFactorial=1;
> while (integer GT 0) {
> TheFactorial = TheFactorial*integer;
> integer = integer-1;
> }
> Return TheFactori
yep, I missed that part.
On Apr 16, 2008, at 10:58 AM, Ian Skinner wrote:
> [EMAIL PROTECTED] wrote:
>> actually, set y: 1,2,3,4,5 would have 32 different combinations
>>
>> null, 1, 1 2, 1 3, 1 4, 1 5, 2, 2 2, 2 3, 2 4, 2 5, 3, 3 3, 3 4, 3 5,
>> 4, 4 4, 4 5, 5, 5 5, 1 2 2, 1 2 3, 1 2 4, 1 2 5, e
And here is where we realize how seriously geeky this list actually is ...
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;251500
G Money wrote:
> 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.
Yes, combination is exactly w
He wants to limit the combination length; in the first example, include only
combinations of exactly 3 digits.
On Wed, Apr 16, 2008 at 10:51 AM, <[EMAIL PROTECTED]> wrote:
> actually, set y: 1,2,3,4,5 would have 32 different combinations
>
> null, 1, 1 2, 1 3, 1 4, 1 5, 2, 2 2, 2 3, 2 4, 2 5, 3,
[EMAIL PROTECTED] wrote:
> actually, set y: 1,2,3,4,5 would have 32 different combinations
>
> null, 1, 1 2, 1 3, 1 4, 1 5, 2, 2 2, 2 3, 2 4, 2 5, 3, 3 3, 3 4, 3 5,
> 4, 4 4, 4 5, 5, 5 5, 1 2 2, 1 2 3, 1 2 4, 1 2 5, etc, 1 2 3 4 5
>
> The formula would be 2^(number of items in set)
Well that
> I don't know if CF has a factorial function, but one would be very easy to
> write.
function Factorial(integer){
Var TheFactorial=1;
while (integer GT 0) {
TheFactorial = TheFactorial*integer;
integer = integer-1;
}
Return TheFactorial;
}
--
Jay
~
actually, set y: 1,2,3,4,5 would have 32 different combinations
null, 1, 1 2, 1 3, 1 4, 1 5, 2, 2 2, 2 3, 2 4, 2 5, 3, 3 3, 3 4, 3 5,
4, 4 4, 4 5, 5, 5 5, 1 2 2, 1 2 3, 1 2 4, 1 2 5, etc, 1 2 3 4 5
The formula would be 2^(number of items in set)
On Apr 16, 2008, at 10:32 AM, Ian Skinner w
> What is the formula to calculate the number of combinations of size x
> [no repeats] that exist in a set of size y?
Combinations are closely related to permutations.
http://www.mathwords.com/c/combination_formula.htm
http://www.easycalculation.com/statistics/learn-permutation-combination.php
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 wou
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
13 matches
Mail list logo