PRINT  Prime Intervals
In this problem you have to print all primes from given interval.
Input
t  the number of test cases, then t lines follows. [t <= 150]
On each line are written two integers L and U separated by a blank. L  lower bound of interval,
U  upper bound of interval. [2 <= L < U <= 2147483647] [UL <= 1000000].
Output
For each test case output must contain all primes from interval [L; U] in increasing order.
Example
Input:
2 2 10 3 7
Output:
2 3 5 7 3 5 7
hide comments
guru_shreyansh:
20210504 12:52:18
Solved in JAVA in 0.55 secs. With bufferedReader & Segmented Sieve. 

4444:
20210102 12:11:20
Thank You @i_m_chitti 

i_0__0_i:
20201109 06:59:40
@Roman Sol


i_am_chitti:
20200725 15:36:29
Use segmented sieve. Don't use cout and cin.


lone_coderrr:
20200626 11:04:37
Easy peasy! AC in one go, used the idea of segmentation for finding primes in range LR and set the upper bound to the sqrt of INT_MAX!! 

ganjaboi:
20200621 07:25:29
sieve of eratosthenes will work here or not


krishp:
20200524 21:23:38
Unfortunately, I do not believe this is solvable in python. Even with optimized segmented sieve + stdin/stdout, you cannot print out all the answers in time. It takes 1.11 seconds just to print out the primes within the range(214748364710**6,2147483647) and with 149 other test cases, it just cannot be achieved in time.


nra:
20200411 18:41:47
"time limit exceeded" every time I run it :( though it runs fine in my machine! any pointers?


deepamgupta:
20200115 18:28:16
I'm getting TLE after applying Segemented Sieve but getting correct answer on my PC, what should I do to optimise? Last edit: 20200115 18:29:15 

hetp111:
20190929 07:37:25
(l/p)*p to find multiple of p in l to r. 
Added by:  Roman Sol 
Date:  20050328 
Time limit:  1.223s 
Source limit:  15000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  ZCon 