function c = combination(n,k)
%COMBINATION Calculate the number of dinstinct selections of k
%            objects from a set of n objects. 
             

if k > n/2, k = n-k; end
    
      nums = (n-k+1):n;
      dens = 1:k;
      nums = nums./dens;
      c = round(prod(nums));