All problems

Problem 862

Three Divisors

Easy · 10 pts · Math, Number Theory

Problem

Decide whether a positive integer N has exactly three positive divisors. Divisors come in pairs (d, N / d), so an odd number of divisors means N is a perfect square. Having exactly three divisors (1, p and p²) means N is the square of a prime p. Check whether N is a perfect square and whether its square root is prime. The numbers in this problem can be larger than a 32-bit int can hold (about 2.1 × 10^9), so use a 64-bit integer type: long long in C++, long in Java (Python needs nothing special).

Input

A single integer N.

Output

Print YES if N has exactly three divisors, otherwise NO.

Constraints

1 <= N <= 10^12

Example input

4

Example output

YES

Explanation

The divisors of 4 are 1, 2 and 4, exactly three, so the answer is YES. The number 2 has only two divisors.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Closest Divisors Next: Count Integers With Even Digit Sum