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
TechIcon01:
2014-06-29 16:37:36
I have written code for this in java and by using seive of erastosthenes method for finding primes number.It is running absolutely perfect in my machine.But spoj says its wrong answer ..i have tested by giving big numbers and with 6 testcases as well..any clue? Last edit: 2014-06-29 16:38:09 |
|
[Lakshman]:
2014-06-27 08:41:17
@code_do RTE because of too much memory allocation at run time, max n can be 10^9 and you can allocate this much of memory, Try to learn segmented sieve. |
|
code_do:
2014-06-27 08:06:51
@Adam I am getting SIGABRT error in my code,but its running fine on ideone.please help me with this
|
|
Poonam Adhav:
2014-06-26 22:04:41
my code runs fine on ideone.com but gives time limit exceeds....please help |
|
kotti satish:
2014-06-25 16:24:13
i've tried many test cases.....still time limit exceeds
|
|
Yosra:
2014-06-25 13:35:47
I got compilation error. Can any one help me to catch what's wrong? |
|
Archit Jain:
2014-06-23 10:12:15
good one...!! |
|
Adarsh K:
2014-06-21 19:22:13
Can anyone give the capacity of given system?? The no of operations it can perform in one second?? Also pls give me the maximum size of an array supported by the compiler... Last edit: 2014-06-21 19:24:26 |
|
kishon:
2014-06-20 20:13:02
I too keep getting runtime error (SIGSEGV) :-( |
|
classified_01:
2014-06-17 19:24:20
Optimized sieve not helping either.....runtime error (SIGSEGV) .
|
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 |