Prime Probablity

4.2

46 votes
Problem

Surya and his girl fiend went on a date during this weekend.There is a sequence of numbers from 1 to 1000000 on a table. Surya picked up a sub sequence SS from it and wants his girl friend to pick a number from SS. What is the probability that the number she picked was a prime number.

Input Format

First Line of input contains T , number of test cases and next T lines contains L and R , the starting number and ending number of the sequence

Output Format

Print the answer with up to 6 digits after the decimal point.

Constraints

1<=T<=100000

1<=L<=R<=1000000

Sample Input
2
1 10
3 3
Sample Output
0.400000
1.000000
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?