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
Baojun Wang:
2014-07-10 03:35:49
why below got WA?
|
|
Mohit Goel:
2014-07-05 22:31:26
I've implemented seive of eratosthenes in java.But here i'm getting NZEC runtime error..Plz somebody help me out..
|
|
kumarmantri:
2014-07-05 19:29:20
my code runs fine on ideone.com but here while compiling it shows time limit exceeded, please help, i used perl
|
|
rushikesh:
2014-07-03 16:39:45
In what way we have to take input and give output
|
|
Shiva Kulshreshtha:
2014-07-02 22:34:35
I used a global array of size 10^6, with Sieve of Eratosthenes, but the judge still says run-time error (sigsegv), someone please help this newbie |
|
AbdalrhmanAtta:
2014-07-02 17:12:50
EASY |
|
velamuri monica:
2014-07-02 10:10:34
when i am trieng in turbo c, ma output is correct. but here the output is wrong. why is it so? |
|
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
|
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 |