Mehta and the Boring Class
Practice
4 (2 votes)
Medium
Algorithms
Mathematics
Sieve
Open
Approved
Factorization
Problem
86% Success 1515 Attempts 30 Points 3s Time Limit 256MB Memory 1024 KB Max Code

Mehta woke up after a long sleep, and decided to attend college class which is infact pretty much unusual. But, to somehow survive this boring class, he asks his friend Verma, to give him a task which he would solve in that boring class. So, Mehta is given the following task.

He has to report the summation of all F(x) for x in range(A,B) where A and B are two given integers that is,

enter image description here

F(x) is defined as sum of powers of primes in prime factorization of x.

For Ex : - F(12) = 3
12 is written as 2^2 * 3^1, so powers are 2 and 1, Hence, F(12) = 2+1 = 3.

So, you being in the same condition as Mehta, decided to solve the same question in the class.

Input:
First Line of the input containts number of test cases T.
Next T lines of input consists of two space separated integers A and B as described in the above task.

Output:
Output the required summation of F(x) for all x in range(A,B) for each test case in a separate line.

Constraints:
A <= B
1 <= A,B <= 10^6
T <= 10^6

Note: Large Input/Output Files, use scanf/printf.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Medium
Points:30
4 votes
Tags:
MathematicsMediumOpenApprovedNumber Theory
Points:30
8 votes
Tags:
MathematicsMedium