Compositeness of Numberland
Output: Standard Output (stdout)
Memory limit: 32 megabytes
Time limit: 2.0 seconds
All the numbers in Numberland wish they had a composed and calm demeanour. In Numberland, this is measured by the compositeness.
The compositeness of a number is the sum of its prime factors, not including itself. Therefore, the compositeness of 12 is 5 = 2 + 3 and the compositeness of a prime number (eg. 19) is 0.
Numberland sometimes sends a team of numbers on a mission. The chances of success depends on the sum of the compositeness of all its members. Your job is to calculate the compositeness of a range of numbers between A and B, so that Numberland may know how likely these numbers are to succeed in their sacred task.
Compositeness knows no 32-bit bounds, 64-bit integers may be required to give a composed answer.
Input
The first line contains two integers A and B (1 \leq A \leq B \leq 10,000,000).
Output
Output the total compositeness of all the numbers between A and B inclusive.
Explanation of 1st sample case: The compositeness of each of the numbers between 1 and 10 are 0, 0, 0, 2, 0, 5, 0, 2, 3, 7. Their sum is 19.
Subtasks
- For 20%, A, B \leq 100
- For 25%, A, B \leq 1,200
- For 25%, A, B \leq 125,000
- For the remaining 30%, no additional constraints apply.
-
Sample Input 1
1 10Sample Output 1
19 -
Sample Input 2
4 6Sample Output 2
7