Monthly Archives: April 2012

Calculating the indices for n choose k

So if you want to calculate n choose k, or n over k or all k different combinations of n unique items or binomial coefficients in Matlab or in math language

\[\frac{n!}{(n-k)! k!}\]

you can write nchoosek(n,k)nchoosek(n,k) But lets say you want to generate a list of these possible combinations? Well then you just write […]