Problems > Is It Prime

Is It Prime

Difficulty: 1300 3000 ms 128 MB

math number-theory

Decide whether N is a prime number.

Input: one integer N.

Output: YES if N is prime, else NO.

Constraints:

  • 1 ≤ N ≤ 1012

Sample Tests

Input 1
97
Output 1
YES
Input 2
100
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.