structure Answers1 : A1 = struct (* Question 1 *) fun C (n,r) = if r <= 0 then 1 else n * C(n-1, r-1); (* Question 2 - improved *) local fun FFtriple 0 = (1,3,5) | FFtriple n = let val (a, b, c) = FFtriple (n-1) in (b, c, a+c+1) end in fun FF n = let val (a,_,_) = FFtriple n in a end end; val FF20 = FF 20 and FF200 = FF 200; (* Question 3 *) fun G(0, b) = 1 | G(n, b) = if n <= b then 2 + G(n-1, b) else G(n-1, b) + G(n-1-b, b) + 1; (* Question 4 *) fun RB 0 = 1 | RB n = RB(n-1) + RB(n div 2) + 1; val RB100 = RB 100; end;