let euler2 limit =
  let a = ref 1 in
  let b = ref 2 in
  let sum = ref 0 in
  while !a <= limit do
    if !a mod 2 = 0 then sum := !sum + !a;
    let c = !a + !b in
    a := !b;
    b := c
  done;
  !sum

;;

euler2 4000000
