(* * $Id: ary3.ocaml,v 1.1 2001/05/31 02:27:48 doug Exp $ * http://www.bagley.org/~doug/shootout/ * with help from Markus Mottl *) let _ = let n = try int_of_string Sys.argv.(1) with Invalid_argument _ -> 1 in let last = n-1 and x = Array.make n 0 and y = Array.make n 0 in for i = 0 to last do x.(i) <- (i + 1) done; for k = 0 to 999 do for i = last downto 0 do y.(i) <- (x.(i) + y.(i)) done done; Printf.printf "%d %d\n" y.(0) y.(last)