PRIME1  Prime Generator
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!
Input
The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, nm<=100000) separated by a space.
Output
For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.
Example
Input: 2 1 10 3 5 Output: 2 3 5 7 3 5Warning: large Input/Output data, be careful with certain languages (though most should be OK if the algorithm is well designed)
Information
After cluster change, please consider PRINT as a more challenging problem.hide comments
hsakiv220290:
20180110 08:35:52
In example, 1st test case ,1 is a prime number. 

vuminhthanh01:
20180103 15:34:27


vuminhthanh01:
20180103 15:34:22
It doesn't work when I use python 3, then I AC with C++ in 1.5s :v


jovice786:
20171228 17:29:10
TLE ?? even after using sieve,,,please help 

sansairama:
20171225 17:04:45
Time limit exceeded any solution?? 

pk159pk:
20171224 04:45:25
just take care of large input and use SIEVE algo to make it run in O(N).


linyu203:
20171222 19:11:08
Something about TLE, if your algorithm does it with filter or screen method with O(n) memory cost (n means the largest number inputted), that may mean you use too much MEM, try other methods with lower time effect, but O(1) memory cost, will be accepted. 

amitkr100:
20171219 22:11:49
Make Seive for 110^6 then extract and store all prime numbers, Now if you need prime >10^6 use stored prime numbers.


aishwarya100:
20171219 14:52:50
Time limit exceeded! 

namanruhela03:
20171214 15:23:49
i don't understand it will always showing TLE again and again ??? 
Added by:  Adam Dzedzej 
Date:  20040501 
Time limit:  6s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 