This is called combination (or k-combination) in mathematic, id est no matter of the order of the elements and no repetition of elements. The formula is the binomial coefiicent one. n! C(n,k) = ---------- k!(n-k)!