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
`Ak:
2014-10-28 12:39:29
Is the time limit been extended as code are being submitted easily on it ??
|
|
appy:
2014-10-26 03:00:12
this question can only be done by
|
|
Daniel Cárdenas:
2014-10-22 11:10:10
Solved it on python. Finally. |
|
Mitch Schwartz:
2014-10-12 18:30:50
@Paradigm Shift: The standard judge on SPOJ ignores extra whitespace. Only in rare cases is a different judge used, and most of the time there is a note about it in the problem statement or a comment about it. |
|
Infinity:
2014-10-12 17:35:29
What to print when there is no prime: an empty line corresponding to it or just ignore that test case ? Last edit: 2014-10-29 05:41:02 |
|
Yash Bansal:
2014-09-25 13:13:32
This is my code. Why i am getting it as wrong answer even it is working fine on my pc compiler?
|
|
Craig:
2014-09-21 01:06:16
For those with "it works on ideone.come, but TLEs here", please note : "Intel Pentium III 733 MHz". You need to code to that limitation. Likewise for "256MB" Last edit: 2014-09-21 01:07:15 |
|
Sachin Gautam:
2014-08-16 20:58:59
solved without using [removed] :P Last edit: 2014-10-29 05:48:21 |
|
[Lakshman]:
2014-07-20 16:00:01
@Aragon!!! Your algorithm is wrong. Do you know how to check a number is prime or not. And your assumption that if number is not divisible by 3,5,7 is prime is wrong. Last edit: 2014-07-20 16:01:27 |
|
Aragon!!!:
2014-07-20 14:26:01
can anyone tell whats wrong in my algo.. its giving proper out for me? <snip> Last edit: 2022-06-19 12:37:16 |
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 |