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, n-m<=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
shiva:
2015-03-15 19:01:40
my program for prime generator works fine but i am facing time limit exceeded problem. i have tested my program on ideone.com but when i try it spoj.com it says time limit exceeded. can anybody help me ?? |
|
`Ak:
2015-03-11 17:13:33
till now it is passing without sieve so pls reduce the time limit
|
|
maria reinzo:
2015-03-09 03:50:45
I give up, I'll go ask around somewhere else. I'm not getting the activation email at all. Last edit: 2015-03-09 03:57:02 |
|
Abhinandan Agarwal:
2015-03-06 08:47:10
Finally in 0.01 time :-) |
|
Shubham Mohanka:
2015-03-04 15:10:22
@ron tle (time limit exceeded) is an error in case when ur program is not fast enough to complete in the given time limit.try using a faster algorithms.if u r a beginner,i will suggest u to google faster primality testing algos.hope that answers ur query.
|
|
ron:
2015-03-04 07:49:08
my program does what the problem is asking for but when I submit it shows TLE. can someone tell me why TLE? |
|
fordex:
2015-03-02 16:51:58
whats the best algorithm to generate primes between any two numbers? Last edit: 2015-03-02 16:52:41 |
|
Nootan R:
2015-02-28 15:03:48
SHOWING WRONG ANSWER
|
|
Shashank kumar:
2015-02-21 06:43:42
no need of seives ...just read an article on wikipedia...about primality test http://en.wikipedia.org/wiki/Primality_test |
|
Biswajit Sahu:
2015-02-19 09:16:56
I'm using Python 2.7.
|
Added by: | Adam Dzedzej |
Date: | 2004-05-01 |
Time limit: | 6s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 |