941. de Bruijn's Combination Lock

de Bruijn has a digital combination lock with k buttons numbered 0 to k1 where k10.
The lock opens when the last n buttons pressed match the preset combination.

Unfortunately he has forgotten the combination. He creates a sequence of these digits which contains every possible combination of length n. Then by pressing the buttons in this order he is sure to open the lock.

Consider all sequences of shortest possible length that contains every possible combination of the digits.
Denote by C(k,n) the lexicographically smallest of these.

For example, C(3,2)= 0010211220.

Define the sequence an by a0=0 and

an=(920461an1+800217387569)mod1012 for  n>0

Interpret each an as a 12-digit combination, adding leading zeros for any an with less than 12 digits.

Given a positive integer N, we are interested in the order the combinations a1,,aN appear in C(10,12).
Denote by pn the place, numbered 1,,N, in which an appears out of a1,,aN. Define F(N)=n=1Npnan.

For example, the combination a1=800217387569 is entered before a2=696996536878. Therefore:

F(2)=1800217387569+2696996536878=2194210461325

You are also given F(10)=32698850376317.

Find F(107). Give your answer modulo 1234567891.

941. 德布鲁因的密码锁

德布鲁因有一个数字密码锁。锁上有 k10 个按钮,它们分别被编号为 0k1。若要打开此锁,那么最后按下的 n 个按钮必须与预设的按钮组合相同。

不幸的是,他忘记了预设的按钮组合。为此,他构造了一个包含了所有长度为 n 的按钮组合的序列。随后,只要顺序按下该序列中的按钮,他就能打开此锁。

考虑所有最短的、包含了所有长度为 n 的按钮组合的序列,记其中字典序最小的一个序列为 C(k,n)。例如:C(3,2)= 0010211220。

按如下规则定义数列 ana0=0,且

an=(920461an1+800217387569)mod1012, 对诸  n>0

我们将诸 an 视作一种长度为 12 的按钮组合,若 an 在十进制下不足 12 位,则加前导零补齐至 12 位。

给定正整数 N,我们对 a1,,aNC(10,12) 中的出现顺序尤其好奇。我们将 a1,,aN 中第一个出现的组合记为第 1 名,由是递推,得到所有组合的名次。记 ai 的名次为 pi,并记 F(N)=n=1Npnan

例如,在 C(10,12)a1=800217387569a2=696996536878 先出现,于是:

F(2)=1800217387569+2696996536878=2194210461325

你亦已知 F(10)=32698850376317

F(107)1234567891 的值。


这个链接 回到源站。

这个链接 回到详细版题目目录。