PON - Prime or Not


Given the number, you are to answer the question: "Is it prime?"

Solutions to this problem can be submitted in C, C++, Pascal, Perl, Python, Ruby, Lisp, Hask, Ocaml, Prolog, Whitespace, Brainf**k and Intercal only.

Input

t – the number of test cases, then t test cases follows. [t <= 500]
Each line contains one integer: N [2 <= N <= 2^63-1]

Output

For each test case output string "YES" if given number is prime and "NO" otherwise.

Example

Input:
5
2
3
4
5
6

Output:
YES
YES
NO
YES
NO

hide comments
Endang Wahyu Pamungkas: 2011-03-21 08:51:50

what the answer if input=1.??

Armin A¹imoviæ: 2011-02-26 20:04:59

Weak test cases. Two iterations with Little Fermat's Theorem :)

sandeep pandey: 2010-12-26 15:03:17

yes..weak test cases!!!!
got accepted wd 1 iteration wd miller rabin...

VinyleEm: 2010-12-23 16:49:12

Input isn't properly formatted. I take this occasion to reiterate that problem setters shall format their input files properly and also state the proper input format in the statement.

Tommy Anandra: 2010-12-20 15:09:09

what is the formula that can be check until 2^63?

:D: 2010-11-17 10:37:19

The question was asked below. Use "long long" or "unsigned long long" in c++, "long" in java.

tirta: 2010-11-17 10:08:16

How to store an integer of range 2^63-1 ?

.:: Jarv1s ::.: 2010-09-19 13:20:35

yeah very very weak test cases!
My algorithm has been ranked 60th

Last edit: 2010-09-19 13:22:34
Ankul Garg: 2010-06-04 06:04:04

Weak test cases!!!

Seshadri R: 2009-10-23 06:10:15

@krishna kant
Use unsigned long long t;
printf("%llu", t) for printing t's value


Added by:Roman Sol
Date:2005-01-24
Time limit:21s
Source limit:5000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ADA95 ASM32 BASH CSHARP CLPS D ERL FORTRAN ICON JAVA JS-RHINO LUA NEM NICE PHP PIKE ST
Resource:ZCon 2005