All tasks
Mediummath

Prime Check

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

You are given an integer n. Print YES if it is prime, otherwise NO. A prime is greater than 1 and divisible only by 1 and itself. The number 1 is not prime.

Examples

Example 1
Input
7
Output
YES
Example 2
Input
10
Output
NO

Constraints

  • 1 ≤ n ≤ 10^12
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.