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