TJUC1 - Divisors

no tags 

 

We define the function f(x) = the number of divisors of x. Given two integers a and b (ab), please calculate

f(a) + f(a+1) + ... + f(b).

 

Input

Two integers a and b for each test case, 1 ≤ ab ≤ 231 - 1. The input is terminated by a line with a = b = 0.

Output

The value of f(a) + f(a+1) + ... + f(b).

Sample Input

9 12

1 2147483647

0 0

Sample Output

15

46475828386

 

Hint

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.

 

if you find Source code limit is small here you can solve the tutorial version here :
http://www.spoj.com/problems/TJUT1/


hide comments
Ashwini: 2013-10-27 07:10:09

with the most efficient of algorithm i am getting tle

Aditya Pande: 2013-10-18 00:32:34

Source code limit is small :p (100 B is sufficient)
Why am i stuck at 91 B?


Added by:abdou_93
Date:2013-10-16
Time limit:3.427s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:TJU