I am trying to find the sum of integers ( (int)(a*i)/b ) where i is from 0 to 10^10.

The problem is a/b >=1 and can be a fraction also and a and b are constant

If it wasnt a fraction then it was really easy i*(i+1)/2 * a/b

Any ideas ?

AJ

Recommended Topics