Cracking any linear congruential generator

282 Views Asked by At

I have a linear congruential generator $X_{n+1} = (aX_n + b) \bmod 2^k $with given arguments and number $Y$. The problem is to find the smallest $i$ that $X_i = Y$ or tell that there is no such $i$. How to solve that faster than simple approach with iterating all numbers?