Primes 3

Given T (1 ≤ T ≤ 100) positive integers, one per line, determine whether each one is prime. The integers will be no greater than 263−1.

The first line of input will be the integer T. The next T lines each contain a number to be tested.

For each of the T integers, you should output on a separate line PRIME if the corresponding integer is prime, or NOT if it is composite.

Sample Input

5
1
2
6
11
1000000000000000000

Sample Output

NOT
PRIME
NOT
PRIME
NOT

All Submissions
Best Solutions


Point Value: 20 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Jan 03, 2014
Author: Alex

Languages Allowed:
C++03, PAS, C, ASM, C++11

Comments (Search)

Whats wrong with my code. I tried it so many times.

This is a blast XD

This is basically the exact same as Vanilla Primes except the output is in CAPS and nums are possibly bigger. Then why is python not allowed?

The numbers are a LOT bigger in this problem. I'm pretty sure that Python and Java aren't allowed because they have bignum and biginteger which make this problem easier.

in python there is no integer overflow thats why it cant be used for this and aplusb2

Although, for what it's worth, BigIntegers would be so ridiculously slow when it comes to exponentiation on the level required for this question there's not a chance they could pass in time. I'd wager that Java is disabled because of BigInteger.isProbablePrime(), I'm not sure for python

No; C/C++ can go that high with [unsigned] long long. I think Java's banned because of isProbablyPrime(); too haxy, but IDK about Python. I think there's probably some import answer or something.