Vasya and prime numbers
Easy
Execution time limit is 1 second
Runtime memory usage limit is 129.002 megabytes
Vasya learned at math lesson that prime number is a positive integer that is divisible only by 1 and itself, and the number 1 is not a prime. Vasya knows that Pete likes to give a lot of questions like "from l to r". Vasya found himself a new task: count the number of primes in the interval from l to r.
Input
Consists of multiple test cases. Each test contains on a separate line two (possibly negative) integers l and r (l ≤ r, |l|, |r| < 10^6
). The last line contains two numbers -1 and is not processed.
Output
For each test case print on a separate line the number of primes from l to r.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 4K
Acceptance rate 17%