let $a, n, m \in \mathbb{Z}$ and $i\in\mathbb{N}$ and $$(a+in) \mod m$$
Is there a closed way to tell for what $i$ the congruence begins to cycle?
Thanks
let $a, n, m \in \mathbb{Z}$ and $i\in\mathbb{N}$ and $$(a+in) \mod m$$
Is there a closed way to tell for what $i$ the congruence begins to cycle?
Thanks
$\newcommand{\lcm}{\operatorname{lcm}}$If the sequence cycles, then $a+in \equiv a+jn \bmod m$ and so $(i-j)n\equiv 0 \bmod m$. So, you want the smallest multiple of $n$ that is also a multiple of $m$. This by definition is $\lcm(m,n)$.
You have to solve $in=\lcm(m,n)$. Since $\lcm(m,n)=\dfrac{mn}{\gcd(m,n)}$ we have $i=\dfrac{m}{\gcd(m,n)}$.