(* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. *) open Big_int;; let sumofprimes = let rec sumup x ps s = if( x mod 100 = 0) then (Printf.printf "%d\n" x) else (); if (x>2000000) then s else if (List.exists (fun y -> (x mod y=0) ) ps) then sumup (x+1) ps s else sumup (x+1) (x::ps) (add_int_big_int x s) in sumup 2 [] (big_int_of_int 0) ;; Printf.printf "%s\n" (string_of_big_int sumofprimes);;