Need more insight on a formula

44 Views Asked by At

Following is a part of a programming contest problem.

Given $C_{1},m,n,o,x,y,z,c,d,K,J$ are positive integers

$ C_{i} = \left\{ \begin{array}{l l} (m*C_{i-1}^2 + n*C_{i-1} + o) \bmod J & \quad \text{if $c^i \bmod d <= K$}\\ (x*C_{i-1}^2 + y*C_{i-1} + z) \bmod J & \quad \text{if $c^i \bmod d > K$} \end{array} \right.$

I noticed that the value of $C_{2}$ to $C_{x}$ repeats. i.e

$C_{x+1} = C_{2}, C_{x+2} = C_{3} .....C_{2x-1}=C_{x}, C_{2x} = C_{2} ......$

Is my observation correct? and is there is any other characteristics I should know of.