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
nongdancoder:
2024-10-08 14:46:19
it should be prime or R not
|
|
nob_python69:
2024-06-29 06:35:09
why miller-rabin wrong?
|
|
ismaelkno:
2024-03-11 06:28:01
AC AFTER 7 WA'S IZI PIZI BRUH PUT STRONGER CASES I FALL ASLEEP ZZZZZ |
|
quarkeby3:
2024-01-10 10:50:35
learn the Miller Rabin Primality tests [cp-algorithms], easy in one go Last edit: 2024-01-10 10:50:57 |
|
hoangziet22:
2023-12-17 13:51:00
Why is it TLE ?????
|
|
trumcspkkk6969:
2022-11-17 17:14:23
1 time miller rabin also get ac
|
|
gekko_code:
2021-04-16 06:42:23
Try to use deterministic Miller Rabin algorithm, it only takes 0.01sec for this problem. Last edit: 2021-04-16 06:43:05 |
|
houda_bh:
2021-02-13 12:31:54
time limit exceeded what to do ? |
|
mamun_01_neub:
2020-10-22 20:53:27
why it is run time error? |
|
chikku:
2020-08-06 21:56:17
Use Miller Rabin Test, and get AC..
|
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 |