TJUT1 - Divisors
We define the function f(x) = the number of divisors of x. Given two integers a and b (a ≤ b), please calculate f(a) + f(a+1) + ... + f(b).
Input
Two integers a and b for each test case, 1 ≤ a ≤ b ≤ 231 - 1. The input is terminated by a line with a = b = 0.
Output
The value of f(a) + f(a+1) + ... + f(b).
Example
Input: 9 12 1 2147483647 0 0 Output: 15 46475828386
Explanation
For the first test case:
- 9 has 3 divisors: 1, 3, 9.
- 10 has 4 divisors: 1, 2, 5, 10.
- 11 has 2 divisors: 1, 11.
- 12 has 6 divisors: 1, 2, 3, 4, 6, 12.
So the answer is 3 + 4 + 2 + 6 = 15.
Added by: | abdou_93 |
Date: | 2013-10-16 |
Time limit: | 1.182s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | TJU |