Function overview
Prototype
unique_combinations_counter (
number_values )
Parameters
number_values
Description
Tags:
statistics Number
This function calculates the number of unique combinations of n values (WARNING 212 Values Max)
ex :
list = "a¶b¶c¶d" ----> 4 values
combinations = "a¶b¶c¶d¶ab¶ac¶ad¶bc¶bd¶cd¶abc¶abd¶acd¶bcd¶abcd"
---> 15 unique values (without aa, abc=bca=cab=acb...)
Examples
Sample input
unique_combinations_counter(4)
unique_combinations_counter(50)
Sample output
15
1125899906842623
Function code
/* unique_combinations_counter (number_values)
by Eric Plassot
v.1, May 2009
This function calculates the number of unique combinations of n values (WARNING 212 Values Max)
ex :
list = "a¶b¶c¶d" ----> 4 values
combinations = "a¶b¶c¶d¶ab¶ac¶ad¶bc¶bd¶cd¶abc¶abd¶acd¶bcd¶abcd"
---> 15 unique values (without aa, abc=bca=cab=acb...)
NOT RECURSIVE
CUSTOMLIST function required
*/
Definir(
[
$n_val=number_values;
$n_combcum = "";
calc = CustomList (
1;
$n_val;
"Let(
[
val = Combination ($n_val;[n]);
$n_combcum = $n_combcum+val
];
\"\"
)"
)
];
$n_combcum
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/227
Prototype: unique_combinations_counter( number_values )
Function Author: Eric (http://www.fmfunctions.com/mid/128)
Last updated: 24 May 2009
Version: 1.1
*/
// ===================================
/* unique_combinations_counter (number_values)__LITBR____LITBR__by Eric Plassot__LITBR____LITBR____LITBR__v.1, May 2009__LITBR____LITBR__ __LITBR__This function calculates the number of unique combinations of n values (WARNING 212 Values Max)__LITBR__ex : __LITBR__list = "a¶b¶c¶d" ----> 4 values__LITBR__combinations = "a¶b¶c¶d¶ab¶ac¶ad¶bc¶bd¶cd¶abc¶abd¶acd¶bcd¶abcd"__LITBR__---> 15 unique values (without aa, abc=bca=cab=acb...)__LITBR____LITBR____LITBR__NOT RECURSIVE__LITBR____LITBR__CUSTOMLIST function required__LITBR____LITBR__*/__LITBR____LITBR____LITBR__Definir(__LITBR__[__LITBR__$n_val=number_values;__LITBR__$n_combcum = "";__LITBR__calc = CustomList (__LITBR__ 1;__LITBR__ $n_val; __LITBR__"Let(__LITBR__[__LITBR__val = Combination ($n_val;[n]);__LITBR__$n_combcum = $n_combcum+val__LITBR__];__LITBR__\"\"__LITBR__)"__LITBR__)__LITBR__];__LITBR__$n_combcum__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/227__LITBR____LITBR__ Prototype: unique_combinations_counter( number_values )__LITBR__ Function Author: Eric (http://www.fmfunctions.com/mid/128)__LITBR__ Last updated: 24 May 2009__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.