0 down vote favorite
Problem Statement
Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P.
Output: Print per line one integer( ≤ 1015 ). Don't print more than 106 integers in all.
Scoring: Let N = correct outputs. M= incorrect outputs. Your score will be max(0,N-M).
Note: Only one of P and reverse(P) will be counted as correct. If both are in the file, one will be counted as incorrect.
Sample Output 107 13 31 17 2
Explanation Score will be 1. Since 13,107,17 are correct. 31 is incorrect because 13 is already there. 2 is incorrect.
Time Limit 2 sec(s) (Time limit is for each input file.)
Memory Limit 256 MB
Source Limit 25 KB
Problem Statement
Generate as many distinct primes P such that reverse (P) is also prime
and is not equal to P.
Output:
Print per line one integer( ≤ 1015 ). Don't print more than
106 integers in all.
Scoring:
Let N = correct outputs. M= incorrect outputs. Your score
will be max(0,N-M).
Note: Only one of P and reverse(P) will be counted as correct. If both
are in the file, one will be counted as incorrect.
Sample Output
107 13 31 17 2
Explanation
Score will be 1. Since 13,107,17 are correct. 31 is
incorrect because 13 is already there. 2 is incorrect.
Time Limit
2 sec(s) (Time limit is for each input file.)
Memory Limit
256 MB
Source Limit
25 KB
My question is, is it possible to optimize the following code further, is it possible to reduce execution time to 2 secs, if we are given that we have to use pythonthe Python language.