#64Medium
Is it prime
Time: 1 s · Memory: 256 MB
- Working with numbers
Statement
You are given a natural number . Is it prime? A prime is a number greater than divisible only by and by itself.
Input format
A single integer ().
Output format
YES if it is prime, NO otherwise.
Examples
Input
107
Output
YES
Input
91
Output
NO
Note
It is enough to search for divisors up to (d * d <= n): for that is steps, while going up to would take — too slow.
is not prime. In the second example . Numbers up to need long long / int64 — and d * d must be computed in that type as well.
