(* la suite de fibonacci *) (* programmation grand-père+père+fils+anthropophagie*) let fils gp p=p+gp;; let suit (a,b)=(b,fils a b);; let rec u = function |0->(0,1) |n->suit (u (n-1));; (***********************************************************) (* programmation directe par la formule *) let fib_direct n= let r=(1.+.sqrt(5.))/.2. in int_of_float(0.5+.r**(float_of_int n))/. sqrt(5.));; (***********************************************************) (* The Fibonacci function, once more. *) let rec fib n = if n < 2 then 1 else fib(n-1) + fib(n-2) ;;