I want a fast algorithm to calculate no of permutations for n elements with some elements identical.
Using formula :
n! / k1! k2!....km!
where ki = no of i elements, i = (1,2,...m)
and k1 + k2 + ...... + km = n
Without calculating each factorial as if n is a large no like 400, 400! goes out of range of long long int( largest possible size in c++ ).
If you are posting code please use c/c++.
Thanx in advance :)