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
dwij28:
2015-08-28 00:26:45
My first ever implementation of Miller Rabin. Learnt a lot. :) |
|
Mohit Rathore:
2015-08-26 16:11:57
http://www.spoj.com/problems/ZSUM/ Solve this first! |
|
SangKuan:
2015-07-03 14:28:27
AC but still do not understand then Miller rabin |
|
kartikay singh:
2015-06-05 20:46:08
JUST 1 ITERATION OF MILLER RABIN :)
|
|
_R0b_:
2015-04-26 22:33:44
go with : - > Miller rabin |
|
Madhav:
2015-04-09 18:38:13
miller rabin works!! |
|
Sayak Haldar:
2015-03-10 08:37:19
This problem has weak test cases....there is no checking for pseudoprimes (like 9,2047. etc) Last edit: 2015-03-11 17:45:27 |
|
Abhinandan Agarwal:
2015-01-23 22:08:16
Accepted with Miller Rabin , but failed with Fermat's probability test ...
|
|
lovecode:
2015-01-18 05:54:22
learned a new thing............AC finally Last edit: 2015-01-18 05:55:07 |
|
Kriti Joshi:
2014-10-25 10:40:02
So much to learn in a single ques!! adorable, but 0 point Last edit: 2014-10-25 10:40:38 |
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 |