Problem:The number of ways to choose m items from n items can be presented as (n, m),
which is n! / ((n-m)! * m!), if you calculate directly by factoring it, it either will take you tons of time to compute it, or it may cause arithmetic overflow.
So there is an easy and more secure way to calculate it.
(n, m) = (n-1, m-1) + (n-1, m).
This can be explains as :
Consider whether the n th element appears in one of the (n, m) subsets of m elements. If so, we can complete the subset by picking m−1 other items from the other n − 1. If not, we must pick all m items from the remaining n − 1.