• https://me.yahoo.com
COST (GBP)
0.62
0.00
0

# Multinomial

Calculates the multinomial coefficient with the given arguments.
Controller: CodeCogs

C++

## Multinomial

 intmultinomial( int n int* factors )
This function calculates the multinomial coefficient with the given arguments $\inline&space;&space;k_1,&space;k_2,&space;\ldots&space;k_n$,

$(k_1,&space;k_2,&space;\ldots&space;k_n)!&space;=&space;\frac{(k_1&space;+&space;k_2&space;+&space;\ldots&space;+&space;k_n)!}{k_1!&space;k_2!&space;\ldots&space;k_n!}$

It uses a direct algorithm and so computer overflow may occur during the intermediate calculations, as opposed to the other multinomial component.

## References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

### Example 1

#include <codecogs/maths/combinatorics/arithmetic/multinomial.h>
#include <iostream>
int main()
{
int factors[4] = {1, 2, 3, 4};
std::cout << "In the case of the following factors" << std::endl;
for (int i = 0; i < 4; i++)
std::cout << factors[i] << "  ";
std::cout << std::endl << "the multinomial coefficient is" << std::endl;
std::cout << Maths::Combinatorics::Arithmetic::multinomial(4, factors) << std::endl;
return 0;
}
Output: In the case of the following factors 1 2 3 4 the multinomial coefficient is 12600

### Parameters

 n the number of arguments factors the factors of the multinomial, given as an array

### Returns

the multinomial coefficient based on the values of the factors

### Authors

Lucian Bentea (August 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.