title: f(n) = (n mod 1) + (n mod 2) + (n mod 3) + ... + (n mod n) |AND| f(n)=f(n-1) |AND| L ≤ n ≤ R |AND| (1 ≤ L ≤ R ≤ 10^18). Find the sum of all n
body: <p>Please guide me through <a href="https://www.spoj.com/problems/OPMODULO/" rel="nofollow noreferrer">this problem</a>:</p>
  <blockquote>
  <p>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 &quot;Operation - Modulo&quot;. 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).</p>
  <p>Input:</p>
  <p>First and the only line of input contains two positive integers, L and R (1 ≤ L ≤ R ≤ 1018).</p>
  <p>Output:</p>
  <p>Print the demanded sum in one line.</p>
  </blockquote>