0%

Problem 427


Problem 427


n-sequences

A sequence of integers S = {si} is called an n-sequence if it has n elements and each element si satisfies 1 ≤ si ≤ n. Thus there are nn distinct n-sequences in total. For example, the sequence S = {1, 5, 5, 10, 7, 7, 7, 2, 3, 7} is a 10-sequence.

For any sequence S, let L(S) be the length of the longest contiguous subsequence of S with the same value. For example, for the given sequence S above, L(S) = 3, because of the three consecutive 7’s.

Let f(n) = ∑ L(S) for all n-sequences S.

For example, f(3) = 45, f(7) = 1403689 and f(11) = 481496895121.

Find f(7 500 000) mod 1 000 000 009.


n-序列

整数序列S = {si}被称为n-序列,如果它有n个元素,而且每个元素si满足1 ≤ si ≤ n。因此,一共有nn个不同的n-序列。例如,序列S = {1, 5, 5, 10, 7, 7, 7, 2, 3, 7}就是一个10-序列。

对于任意序列S,记L(S)是其中相同元素连续出现的最大次数。例如,对于上述序列S,L(S) = 3,因为其中有连续出现的3个7。

对于所有的n-序列S,记f(n) = ∑ L(S)。

例如,f(3) = 45,f(7) = 1403689,f(11) = 481496895121。

求f(7 500 000) mod 1 000 000 009。