For a sixth grade science project I asked how to scale the following formula:
$X_{n+1} = (a X_n + b)\, \textrm{mod}\, m$
And in the answer (Which did work) They said that x generates whole numbers between 1 and m-1. But my understanding was that the max that $x\, \textrm{mod}\, m$ could be with x and m being any finite number is $m\div2-1$ which is when x is $m\div2+1$ My question is how can x ever reach to m-1 if the maximum it can be is $m\div2-1$?
Edit: I now understand why the max is m-1 and how it can be represented but are there any numerical examples of where $a\, \textrm{mod}\, b = b-1$?
There are always $n$ integers modulo $n$. When we choose representatives for these, there are a lot of options available. A common choice is $\{ 0,1,\dots,n-1 \}$, for instance. However, any $n$ consecutive integers work. For instance, another relatively common choice is $\{ 1,2,\dots,n \}$. In certain applications, it's desirable to extend in both directions away from zero. When $n$ is even this can be done with $\{ -n/2,-n/2+1,\dots,n/2-1 \}$ or $\{ -n/2+1,-n/2+2,\dots,n/2 \}$. The situation is even more convenient when $n$ is odd because then the result can be symmetric: $\{ -(n-1)/2,-(n-1)/2+1,\dots,(n-1)/2 \}$.