module FMath = struct let is_prime n = if n < 2 then false else if n = 2 then true else if ((n mod 2) = 0) then false else let sqrt_n = (int_of_float (sqrt (float_of_int n)) + 1) in let rec rec_is_prime p = let p2_1 = (p * 2) + 1 in if (p2_1 > sqrt_n) then true else if ((n mod p2_1) = 0) then false else rec_is_prime (p + 1) in rec_is_prime 1;; let primes limit = let rec acc n result = if (n = limit) then result else if (is_prime n) then acc (n + 1) (n :: result) else acc (n + 1) result in acc 2 [];; end let () = let n = read_int () in (if n = 1 then "NO" else if FMath.is_prime n then "YES" else "NO") |> print_string; print_newline ();;