Submit | All submissions | Best solutions | Back to list |
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.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 |
hide comments
|
||||||||||||||
2014-01-22 14:28:31 Sayed Jaffar
@N. K. The input will be:(nothing) because no prime number between 1 and 1 welcome |
||||||||||||||
2014-01-19 10:28:12 N. K.
what if the input : 1 1 1 the problem does not specify the lower bound of n-m... so n-m=0 is legal ? Last edit: 2014-01-19 10:47:51 |
||||||||||||||
2014-01-17 15:15:32 Md. Baker Hossen
----Adam Dzedzej In Ideone My code has successfully runned. But When I submit spoj It shows me "Time Limit Exceeded". What's Problem Please Explain me. <snip> Last edit: 2022-06-19 12:35:00 |
||||||||||||||
2014-01-16 09:31:15 appy
tle error...how to do such programs....can sum1 explain any algo associated with dis problem |
||||||||||||||
2014-01-09 20:45:19 Cristian Maruan Bosin
I have no idea why my code is taking so much time to run.. I've tried lots of times different submissions and all of those has the same problem.. Is this just happening to me ?? :/ (problem: time limit exceeded) My code: <snip> Last edit: 2022-06-19 12:33:23 |
||||||||||||||
2014-01-09 17:16:15 Douglas De Rizzo Meneghetti
Hey guys, I solved it, but when I submit, I receive a SIGSEGV. Can someone spot the mistake? <snip> Last edit: 2022-06-19 12:34:06 |
||||||||||||||
2014-01-07 18:56:43 Micha³ Klawikowski
@Babita u're scanning only 10 first digits, no matter how many cases is bound to be done. Besides writing anything BUT the answer mentioned in the description will be tolerated as invalid. |
||||||||||||||
2014-01-05 05:35:01 Babita Naagar
I have written the code, it runs perfectly on ideone too, but here it is showing a run time error. I have read it several times but haven't been able to spot any error. Please help. Here is the code : <snip> Last edit: 2022-06-19 12:34:01 |
||||||||||||||
2014-01-02 19:56:15 Rishiraj
are "Command line arguments" valid ??? |
||||||||||||||
2014-01-02 19:05:14 Sahebjot Singh
I am getting wrong answer as the reply, But I am getting the right answer for the test cases. I added a new line between inputs aswell. I am not taking the inputs with a space in between, is that necessary? <snip> Last edit: 2022-06-19 12:33:55 |