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-10-01 17:53:01
Code ststus is "success" in idone.com but SPOJ environment showing error. why? Any suggestion? |
||||||||||||||
2015-09-30 15:42:54
time limit exceeded!! any suggestions? |
||||||||||||||
2015-09-30 08:56:55
time limit exceeded help |
||||||||||||||
2015-09-22 17:00:46
Segmented SIeve, you get a green tick :) |
||||||||||||||
2015-09-20 17:28:24 armagan
can anyone help me with the prime generator program |
||||||||||||||
2015-09-20 14:59:47
well i'm getting segmentation fault someone help me out here please ! |
||||||||||||||
2015-09-19 21:29:47
my prog is running in c but its giving runtime error? whats wrong with it? Last edit: 2015-09-19 21:32:50 |
||||||||||||||
2015-09-17 15:57:21
My solution in Python gets a TLE, but the same solution in java runs in 2.3s. You don't need Sieve to get your Java solution AC. And I just tested it with PYPY and I got AC in 1.01s. So I think it is the CPython 3 the one getting TLE. Last edit: 2015-10-07 15:36:29 |
||||||||||||||
2015-09-12 12:15:12
weak Test Case. |
||||||||||||||
2015-09-11 04:09:19
0.43 secs after lots of tries. Very happy I made it. Python 3.4. Erathostenes and a little bit shifting did the trick Last edit: 2015-09-11 04:10:23 |