Comments on Closed-form expression for sum of Modulo Arithmetic Progression
Post
Closed-form expression for sum of Modulo Arithmetic Progression
+3
−0
Is there any closed-form expression or at least an efficient way to calculate this sum?
$$ \sum_{i=1}^{N} (a \cdot i) \bmod{M} $$we can assume $N$, $a$, and $M$ are large enough such that simple looping is not feasible and that period of the progression is also large.
I am aware of the way to calculate sum of first $N$ modulo natural numbers, but I am not able to extend that idea to this series.
1 comment thread