(* By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6^(th) prime is 13. What is the 10001^(st) prime number? *) let pn = let rec searchpn x ps = if( List.length ps = 10001) then (List.hd ps) else if( List.exists (fun y->(x mod y=0)) ps) then searchpn (x+1) ps else searchpn (x+1) (x::ps) in searchpn 2 [] ;; Printf.printf "%d\n" pn;;