Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let $N,a,b$ be positive integers with $a$ and $b$ coprime to each other.

I can sum up $\sum\lfloor ia/b\rfloor$ (for $i$ from $1$ till $N$) by counting lattice points in a right triangle. This sum can be computed recursively in $O(\log(\max(N,a,b)))$ time.

Is there a similar way to compute $\sum i (i \lfloor a/b\rfloor)$? I am solving some problems for a competition and being computing this sum will simplify my calculations greatly.

share|improve this question
2  
The sum in the title is not the sum in the body. Which one do you really want? –  Gerry Myerson Aug 8 '12 at 5:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.