(* Récursive terminale. Exemple d'utilisation : fibonacci 10 donne 55 *)
let fibonacci = function
| n when n <= 2 -> 1
| n -> let rec loop (x, y) = function
| i when i = n -> x + y
| i when i land 1 = 1 -> loop (x + y, y) (i + 1)
| i -> loop (x, x + y) (i + 1)
in loop (1, 1) 3