TITLE: Modulos race, which formula reach 100 first?
QUESTION [5 upvotes]: I would like to know if there was a way to determine according to this formula:
\begin{equation*}
\sum_{i=0} \frac{A*i+B \pmod{100}}{100}
\end{equation*}
and the same with different values of A and B
\begin{equation*}
\sum_{i=0} \frac{A'*i+B'\pmod{100}}{100}. 
\end{equation*}
If there is a way to determine which one reach 100 the fastest?
Assuming $A, B \in \Bbb N$ and $ A \neq 0$

REPLY [2 votes]: Not a full answer, but it will sometimes solve the problem.  We can recast the question to be for what $n$ does $\sum_{i=0}^n (Ai+B) \pmod {100}$ reach $10000$  If $A$ is coprime to $100$, when we have summed $100$ terms we will have one each of $0$ through $99$, for a sum of $4950$.  After two cycles, so at $n=199$ the sum will be $9900$  We then have to ask after how many more terms we have accumulated the missing $100$.  I don't see a simple way to get there.  
If $A$ is not coprime to $100$, let $d=\gcd(A,100)$.  After $\frac {100}d$ terms we have gone through a cycle.  The $Ai$ terms will contribute $d\frac 12\cdot \frac {100}d(\frac {100}d-1)=50(\frac {100}d-1)$ to the sum, while the $B$'s will contribute $(B \pmod d)\frac {100}d$  For example, let $A=35$, so $d=5$.  Each cycle of $20$ will get $0,5,10\dots 95$ from the $Ai$, summing to $950$.  We also get $B \pmod 5$ from the $B$'s, so if $B=8$ this will contribute another $60$ and we get a total of $1010$ from each cycle of $20$  That means that $10$ cycles of $20$ terms $(n=199)$ will sum to $10100$ and we need to stop a few terms earlier.  Again I don't see a simple formula to determine how many terms earlier.  The one simple observation is that you want $B \pmod d$ to be large to get there quickly.