Can "(input * X) mod Y" with N iterations be computed in less than N operations? I think a simple question but here it goes (and sorry for my lack of math notation skills):
Given input I, a fixed factor X and fixed modulo Y and N iterations, does the process need to be performed consecutively in N steps, or can it be sped up?
I=12345
X=655573
Y=54321
for N=0; N &lt; 10000; N++ {
    I=(I*Y)%X
}
This algorithm is computing $$I'=I\cdot Y^N\bmod X$$. Using a standard square and multiply algorithm you need at most $\lceil 2\log_2(N)\rceil+1$ modular multiplications to compute $I'$.  This is about 33 multiplications for the given example of $N=10,000$ which probably counts as this algorithm being &quot;predictable&quot;.