Problem E: Count DePrimes

Time Limit: 3 seconds

A number is called a DePrime if the sum of its prime factors is a prime number. Given a and b count the number of DePrimes xi such that a<=xi<=b.

Input Format:

Each line contains a and b in the format "a b". 2<=a<=5000000. a<=b<=5000000. Input is terminated by a line containing 0.

Output Format:

Each line should contain the number of DePrimes for the corresponding test case.

Sample Input:

2 5 10 21 100 120 0

Sample Output:

4 9 9

Explanation :

In Test Case 2, take 10. Its Prime Factors are 2 and 5. Sum of Prime Factors is 7, which is a prime . So, 10 is a DePrime. ___________________________________________________________________________________________________________________________

Problem Setter: Ramgopal K

Written for Samhita '08