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
kaustuvsahu:
20180819 17:19:41
even with sieve if i use cout for output time limit exceeded


sam_abhi:
20180817 10:53:28
guys always check for 1. it should not suppose to be printed and use square n method 

div_25:
20180812 20:17:00
Guys check for 1. I spent a ton of time only to find 1 was showing up as prime. And use sqrt(). 

magnus_007:
20180806 12:15:23
use normal method no need to use sieve or segmented 

badtmeez:
20180803 06:58:42
Use segmented sieve....... 

chirag74:
20180802 23:03:52
LOL guys i was literally scratching my head trying to apply sieve of erastothenes to find all primes upto billion and some other algorithm. Trust me it wont work cus they dont even test it upto a billion. Just check if the number is a prime each time. LOLOLOL. Man i hate this question. I really wonder why is it in classical? 

paresh121:
20180801 16:34:14
how to reduce time to print a number?


division_7:
20180801 16:03:48
This Question is amazing as if it has no answer to it i tried using python,c and cpp even that sieve algo none works only TLE error is there my god. 

priyankamani:
20180801 15:28:06
why you are saying the answer is wrong .plz give the test cases 

suyashky:
20180731 15:35:14
Do not forget to check 1! 
Added by:  Adam Dzedzej 
Date:  20040501 
Time limit:  6s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 