(* The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? *) open Big_int;; (* largest prime factor *) let lpf = let rec factorize i n = if(ge_big_int i n) then Printf.printf "%s\n" (string_of_big_int n) else factorize (succ_big_int i) ( if(eq_big_int (mod_big_int n i) (big_int_of_int 0)) then (div_big_int n i) else n ) in factorize (big_int_of_int 2) (big_int_of_string "600851475143") ;;