Check If a Number Is Prime
Determine whether a given number is prime in O(sqrt(N)) time.
Input format
The first line contains X (1 ≤ X ≤ 10^12, including 1, 2, squares of primes, large primes like 999999999989).
Output format
Print true if X is prime, false otherwise.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
1Expected output
falseExample 2
Input
2Expected output
true