924. Larger Digit Permutation II

Let B(n) be the smallest number larger than n that can be formed by rearranging digits of n, or 0 if no such number exists. For example, B(245)=254 and B(542)=0.

Define a0=0 and an=an−12+2 for n>0. Let U(N)=∑n=1NB(an). You are given U(10)≡543870437(mod109+7).

Find U(1016). Give your answer modulo 109+7.

924. 更大的数位排列数 2

记 B(n) 为:通过重排 n 的数位,可以得到的最小的 >n 的数。如果这样的数不存在,则置 B(n)=0。例如,B(245)=254、B(542)=0。

定义如下递推:a0=0,且对诸 n>0 有 an=an−12+2 成立。记 U(N)=∑n=1NB(an),已知 U(10)≡543870437(mod109+7)。

求 U(1016) 模 (109+7) 的值。


点 这个链接 回到源站。

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