(*
 * Check if the given year is a leap year. This will return true if the given
 * integer is larger than 1582, can be divided by 4, but not by 100, or it can
 * be divided by 400. Otherwise, false is returned.
 *)
let isLeapYear x =
    x > 1582 && x mod 4 == 0 && (x mod 100 != 0 || x mod 400 == 0)
;;

let testLeapYear x =
    Printf.printf "%d: %b\n" x (isLeapYear x);;

(testLeapYear 1400);; (* false *)
(testLeapYear 1582);; (* false *)
(testLeapYear 1583);; (* false *)
(testLeapYear 1584);; (* true *)
(testLeapYear 1700);; (* false *)
(testLeapYear 2000);; (* true *)
