I want to calculate the multinomial coefficient:
where it is satisifed
Another approach is to use Yannis Manolopoulos iterative method.
Suppose we have a vector k
with the multinomial entries.
function N = multicoeff (k),
n=sum(k);
[_,imax]=max(k);
num=[n:-1:n-k(imax)-1];
den=[]; k(imax)=[];
for i=1:length(k), den=[den 1:k(i)]; endfor;
N=prod(num./den);
endfunction
example
octave:2> k = [5 4 3];
octave:3> multicoeff (k)
ans = 27720
Reference: Yannis Manolopoulos. Binomial coefficient computation. ACM SIGCSE Bulletin, 34(4):65, December 2002. doi: 10.1145/820127.820168. URL https: //doi.org/10.1145/820127.820168.