Find the period of sequence.

4.6k Views Asked by At

A sequence is such that its terms are generated by the formula: $$r_i =(ar_{i-1}+b\pmod m)$$

where $a,b,m,r_0$ are given.

find the period,that is the number of terms that are repeated.

For example, if $a = 2, b = 6, m = 12, r_0 = 11$, the generated sequence will be: $4, 2, 10, 2, 10, 2, 10, 2, 10, 2, 10$, ...

period of this is 2 because 2,10 are repeating

how to find the period?