0%

Problem 803


Problem 803


Pseudorandom sequence

Rand48 is a pseudorandom number generator used by some programming languages. It generates a sequence from any given integer 0a0<248 using the rule an=(25214903917an1+11)mod248.

Let bn=an/216mod52. The sequence b0,b1, is translated to an infinite string c=c0c1 via the rule:

0 a, 1 b, , 25 z, 26 A, 27 B, , 51 Z.

For example, if we choose a0=123456, then the string c starts with: “bQYicNGCY”.

Moreover, starting from index 100, we encounter the substring “RxqLBfWzv” for the first time.

Alternatively, if c starts with “EULERcats”, then a0 must be 78580612777175.

Now suppose that the string c starts with “PuzzleOne”.

Find the starting index of the first occurrence of the substring “LuckyText” in c.


伪随机序列

许多编程语言都使用Rand48这种伪随机数生成器。对于任意给定整数0a0<248,它会按照规则an=(25214903917an1+11)mod248生成一组伪随机序列。

bn=an/216mod52。序列b0,b1,会进一步按照以下规则翻译为无限长字符串c=c0c1

0 a,1 b,25 z,26 A,27 B,51 Z。

例如,如果我们选择a0=123456,那么字符串c的开头部分为:”bQYicNGCY”。

进一步地,在字符串下标为100的位置,我们第一次得到子串”RxqLBfWzv”。

另一方面,如果我们希望字符串c的开头部分为”EULERcats”,那么a0必须选定为78580612777175

现在假设字符串c的开头部分为”PuzzleOne”。

求我们第一次在字符串c中得到子串”LuckyText”的起始位置下标。


Gitalking ...