unique_combinations_counter ( )

Function stats

Average user rating
128
227
9999
Support
FileMaker 8.0 +
Date posted
24 May 2009
Last updated
24 May 2009
Version
Recursive function
No

Author Info
 Eric

7 functions

Average Rating None

author_avatar



 

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

*/
// ===================================

 

 

 

 


Login or register to comment

Create a new account with fmcustomfunctions.com or login to post a comment.