let euler25 n =
  let a = ref 1 in
  let b = ref 1 in
  let i = ref 2 in
  let target = ref 1 in
  for _ = 1 to n - 1 do target := !target * 10 done;
  while !b < !target do
    let c = !a + !b in
    a := !b;
    b := c;
    i := !i + 1
  done;
  !i

;;

euler25 12
