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^631]
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
The Terminator:
20130826 16:13:37
acc in little fermat


Dragan MarkoviĆ¦:
20130816 20:21:00
Fermat's primality test is awesome. 

Lakshay Singhal:
20130815 17:00:21
gr8 question...learnt smthng new


Bharath Reddy:
20130617 09:13:33
1 iteration Miller Rabin enough..


Himanshu:
20130602 16:16:02
really very good question learn a lot....


Chandan Mittal:
20130519 20:26:17
using MR test..


ওয়াসী (Wasi):
20130504 12:34:57
AC at 1st submission with Miller_Rabin algo...:D


Ouditchya Sinha:
20130504 11:41:51
Nice problem, Learnt Nondeterministic primality testing algos. AC in 0.16s :) 

mystique_blue:
20130413 06:22:35
So far this is the problem that gave me most number of WA's, and also made me learn a number of amazing algos.

Added by:  Roman Sol 
Date:  20050124 
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 JSRHINO LUA NEM NICE PHP PIKE ST 
Resource:  ZCon 2005 