All submissions for this problem are available.
Chef Polo is experimenting with Prime Numbers. He can quickly tell whether a number is prime or not. His friend Palin knows about it, so he twists the question.
Palin challenges his friend to check whether a number P is "almost prime" or not.
The number P is said to be almost prime if it has exactly 3 distinct divisors.
A number d is said to be divisor of P if P is divisible by d.
Chef Polo is quite intelligent but currently he is busy with preparing delicious dishes. So he wants your help.
First line Contains an integer T, the no of test cases.
Each of next T lines contain a single integer P, the number Palin asks to check.
For each test case, output a string "YES" if the number P is almost prime. Otherwise output "NO"
- 1 ≤ T ≤ 10^5
- 1 ≤ P ≤ 10^12
Input: 4 2 4 7 10 Output: NO YES NO NO
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions