BlueBook - Prime
View as PDFBlueBook
Given  
 integers 
 
, output 
1 if each one is prime, and 0 otherwise.
Remember: an integer is prime iff (if and only if) it has exactly two divisors:  and 
.
Input Specification
Line : one integer 
Lines : one integer 
Output Specification
Lines : One integer 
1 or 0 denoting whether  is prime. Output 
1 if  is prime, and 
0 otherwise.
Sample Input
3
1
2
3
Sample Output
0
1
1
Comments
I am using Python 3 and I got a TLE, I used PyPy 3 and it says it is "failed initializing" someone help
Failed initializing is probably because you ran out of memory. Pypy uses a lot of memory.
My assumption for you getting TLE is that you have iterated through each number in the test case. There is a faster way to test if a number is prime.
I will look into that