module Int = struct type t = int let compare (a: t) (b: t) = if a < b then -1 else if a > b then 1 else 0 end module IntMap = Map.Make(Int) let max = 800000 let _ = let rec loop map a b i = if i < max then loop (IntMap.add i a map) (a+b) a (i+1) else map in loop (IntMap.empty) 1 1 0 let _ = let rec fib a b i = if i < max then fib (a+b) a (i+1) else a, b in let rec loop map a b i = if i > 0 then loop (IntMap.add i a map) b (a-b) (i-1) else map in let a, b = fib 1 1 0 in loop (IntMap.empty) a b max