(****** Concours de Centrale PC 1997 ******) let affiche n a c = (print_int n; print_string " "; print_int (int_of_float a); print_string " "; print_int (int_of_float c); print_newline()) ;; (* Recherche des n premiers TRPI *) let TRPI n = let a = ref 0. and p = ref n and phyt = fun a -> sqrt(a**2.+.(a+.1.)**2.) in while !p>=0 do let c=phyt !a in begin if float_of_int(int_of_float c)=c then (affiche (n- !p) !a c; decr p); a:=!a+.1. end done;; (* Voilà les 9 premiers calculés par CAML 0 0 1 1 3 5 2 20 29 3 119 169 4 696 985 5 4059 5741 6 23660 33461 7 137903 195025 8 803760 1136689 *)