; This example demonstrates how to use Mercury's built-in ; FACT function (FACT(x) = x factorial). The problem is: ; In a bridge game, the declarer controls 7 trump cards. ; We must determine the probability that the remaining ; 6 trump cards are evenly distributed (3 and 3) among ; the opposing two players. We calculate both the ; approximate and the exact probability in this example. ; the binomial coefficient formula ; ways of choosing k of n items C(n,k) := BINOM(n,k) ; = FACT(n) / (FACT(k) FACT(n-k)) ; approximate probability of 3-3 split ProbApprox = C(6,3) / 2^6 ; exact probability of 3-3 split ProbExact = C(6,3) * C(20,10) / C(26,13)