A simple observation can help you compute the required sum.
For example, lets have a range [a, b] = [150, 200] and k be 7. So, the first number divisible by k in [a, b] would be (154):
long left = (a%k == 0) ? a : (a/k) * k + k;
And the last number divisible by k in [a, b] would be (196):
long right = (b%k == 0) ? b : (b/k) * k;
Now if we breakdown the multiples of k in [a, b], we can observe a pattern as follows:
154 = 154
161 = 154 + 1*7
168 = 154 + 2*7
175 = 154 + 3*7
182 = 154 + 4*7
189 = 154 + 5*7
196 = 154 + 6*7
The number of multiples of k in [a+k, b] can be easily calculated using:
long count = (right - left) / k;
And the sum of 1+2+3 ... +count would be:
long firstNsum = (count * (count + 1)) / 2;
And our final sum would be:
long SUM = left + (left*count) + firstNsum * k;
which would be equal to: 154 + (154 * 6) + 21 * 7 = 1225 in our case.