global function choose(integer n, k) atom res = 1 for i=1 to k do res = (res*(n-i+1))/i end for return res end function