Advertisement blocking software were detected ;( Please add this webpage to whitelist.

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!


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.


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.


1 10
3 5


Warning: large Input/Output data, be careful with certain languages (though most should be OK if the algorithm is well designed)


After cluster change, please consider PRINT as a more challenging problem.

hide comments
kiner_shah: 2015-10-05 18:54:23

runtime error! God knows why! Algorithm is perfect! Does c++ have any range constraints?
please check my submission! 15297588

Last edit: 2015-10-05 19:12:40
samnik: 2015-10-05 12:03:33

my code is showing tle error please rectify the code

prajjawal05: 2015-10-04 09:49:35

showing runtime error... yet it works well on codeblocks ===> need help

ghostman13: 2015-10-03 19:03:21

my solution works fine but it's giving wrong answer

hormonas_7: 2015-10-02 10:51:09

My solution gets: runtime error but it works fine here (i think)...

skroxx: 2015-10-01 20:23:15

My code gives runtime error. But for most of the test cases it runs fine

masho: 2015-10-01 17:53:01

Code ststus is "success" in but SPOJ environment showing error. why? Any suggestion?

dungen_master: 2015-09-30 15:42:54

time limit exceeded!!
any suggestions?

ash_king_1: 2015-09-30 08:56:55

time limit exceeded help

umakanth10: 2015-09-22 17:00:46

Segmented SIeve, you get a green tick :)

Added by:Adam Dzedzej
Time limit:6s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All except: NODEJS PERL 6