# Finding a specific word in a substitution cipher

Rand48 is a pseudo-random generator which produces a sequence of any given integer using the following rule:
$$a_n=(25214903917 \cdot a_{n-1})\bmod 2^{48}$$.

If $$b_n=\lfloor a_n/2^{16} \rfloor \bmod 52$$, the sequence $$b_0, b_1, \dots$$ becomes an infinite string called $$c=c_0, c_1, \dots$$ to the following rule: $$0\to a, 1 \to b, \dots , 25 \to z, 26 \to A, 27 \to B, \dots , 51 \to Z$$.

For example, if we choose $$a_0=123456$$, string $$c$$ starts with $$\mathrm {bQYicNGCY}$$.
Correspondingly, if sequence $$c$$ starts with $$\mathrm {EULERcats}$$, then $$a_0=78580612777175$$.

Now, suppose string $$c$$ starts with $$\mathrm {PuzzleOne...}$$, what is the index of the first occurrence of the substring $$\mathrm {LuckyText}$$ in $$c$$? I think in the first step, we should use the $$\mathrm {PuzzleOne...}$$ to calculate $$a_0$$ but I don't know how.

• Your definition is missing the + 11. It should be a_n = (25214903917 * a_n-1 + 11) mod 2^48 to give the results you wrote on the question.
– Leo
Commented Jul 3, 2022 at 11:48