(*Fonction aux -----------*) let sum x = (x mod 10)+(x /10);;(*somme des 4 chiffres*) let mirror x =(*inverse deux chiffres*) let u = x mod 10 and d = x/10 in u*10 +d;; let pal x = mirror(x mod 100) = x /100;;(* retourne true si x est un palindrome*) let parfait x = int_of_float (sqrt(float_of_int x )*. 100.) mod 100 = 0;; (*---------------*) let ctc x = if x/10 mod 2=0&&(x mod 10)mod 2<>0 then(* verif 3 pairs plus le dernier *) if (sum(x mod 100)+sum(x/100))=9 then(* verfif somme = a 9*) if x mod 25 = 0 then (*verfi divisible par 25*) if pal (mirror(x mod 100)*100 + mirror(x / 100)) = true then (*Verfir palindrome*) if parfait x = true then x else invalid_arg "pas parfait" else invalid_arg "pas un palindrome" else invalid_arg"pas divisible par 25" else invalid_arg"somme pas egale a 9" else invalid_arg"3 non pairs";; let day d m y = if m=1||m=3||m=5||m=7||m=8||m=10||m=12 then if d>1 && d<31 then d,m,y else failwith "" else if m=2 then if d>1 && d<28 then d,m,y else failwith "" else if m=4||m=6||m=9||m=10 then if d>1 && d<30 then d,m,y else failwith "" else failwith "";; day 12 9 2024;;