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
Kushagra Lavania:
2015-01-02 14:39:44
tle!!
|
|
rahul goyal:
2014-12-30 11:03:53
awesome problem !!!! time limit is 5 sec .. so think accordingly (y)
|
|
Himanshu Gholap:
2014-12-30 09:46:49
I am getting "time limit exceeding", i my using C, what mistake am i probably making?
|
|
Giovanny Escobar:
2014-12-30 06:21:17
Neeraj Dwivedi, compile using C++ 4.8.1, it works! Last edit: 2014-12-30 06:21:56 |
|
Samarth Agarwal:
2014-12-29 20:04:50
How much time should it take in Milliseconds to find prime numbers within range 999900000-1000000000? Mine takes 1490ms only. Is anybody's algo faster?
|
|
Neeraj Dwivedi:
2014-12-27 09:44:22
plz help to correct my runtime error <snip> Last edit: 2022-06-19 12:39:30 |
|
Parth:
2014-12-26 17:44:26
Can someone please point out why I'm getting the time limit exceeded error. I've used the sieve of eratosthenes algorithm.
|
|
vivek:
2014-12-21 14:33:44
Since, the time to print the answer is more than the actiual calculation of the answer, any hints on that side. |
|
Ketan Sethi:
2014-12-20 10:18:34
My solution is showing NZEC. I have tested my codE and it runs fine. Any suggestions will be really appreciable
|
|
Leetao:
2014-12-20 07:43:30
to my surprise,this problem is so easy.why was correctrate so low? Last edit: 2014-12-20 08:22:36 |
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 |