Post History
#2: Post edited
Closed-form expression for sum of Modulo Arithmetic Progression
Is there any closed-form expression or atleast 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.
- 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: Initial revision
Closed-form expression for sum of Modulo Arithmetic Progression
Is there any closed-form expression or atleast 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.