OPMODULO - "Operation - Modulo"
Mahmud solved some easy math problems from SPOJ and called himself king of number theory. GodFather GodMATHer Rashad heard it and got angry, so he kidnapped Mahmud. Rashad gave him a task called "Operation - Modulo". Mahmud must solve this task, you know what will happen otherwise ;(. In the Operation - Modulo, we define a function f(n) = (n mod 1) + (n mod 2) + (n mod 3) + ... + (n mod n), where n mod x donates the remainder when dividing n by x. Rashad interests with integers n such that f(n)=f(n-1), so he gave Mahmud two numbers L and R, and demands him to find the sum of all integers n such that L ≤ n ≤ R and f(n)=f(n-1).
First and the only line of input contains two positive integers, L and R (1 ≤ L ≤ R ≤ 1018).
Print the demanded sum in one line.
I hope you proved your solution before submitting it :)
@drdrunkenstein, so you see that f(1)=f(0) and f(2)=f(1), so both n=1 and n=2 satisfy f(n)=f(n-1), and the answer is the sum of all such numbers, in this case 1+2 = 3.
Can someone explain me the test cases?
try to figure out the sequence of no.
once you get the idea, the problem is super easy.
can you give more testcase
nice problem @barishnamazov
@barishnamazov Good problem, Успехов!
nice problem bratan. +1