Online Programming Server

Login

Login with facebook [?]

Facebook

Problem 1101: Sum of Primes II

Problem ID 1101
Title Sum of Primes II
pdf  
Description
This task is an advance version of the task 1096. You are given two integers L and R, your task is to add up all primes between L and R, including L and R.
Input
The first line contains an integer T, the number of test cases.
For each of the following T (1 ≤ T ≤ 10) lines, each line contains 2 integers, L and R (1 ≤ L ≤ R ≤ 200000000, R-L ≤ 200000).
Output
For each test case, output the sum of primes between L and R inclusively (including L and R) modulo 1,000,000,007 in a line.
Sample Input
3
11 20
21 30
11 30
Sample Output
60
52
112
Hint
 
Last Modified 2012-05-31 14:47:06
Time Limit 1 seconds
Memory Limit 64 MB
Accepted Solutions 0
Submitted Solutions 0
Difficulty Factor 250