Problem 423
Consecutive die throws
Let n be a positive integer.
A 6-sided die is thrown n times. Let c be the number of pairs of consecutive throws that give the same value.
For example, if n = 7 and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value:
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
Therefore, c = 3 for (1,1,5,6,6,6,3).
Define C(n) as the number of outcomes of throwing a 6-sided die n times such that c does not exceed π(n).1
For example, C(3) = 216, C(4) = 1290, C(11) = 361912500 and C(24) = 4727547363281250000.
Define S(L) as ∑ C(n) for 1 ≤ n ≤ L.
For example, S(50) mod 1 000 000 007 = 832833871.
Find S(50 000 000) mod 1 000 000 007.
1 π denotes the prime-counting function, i.e. π(n) is the number of primes ≤ n.
连续扔骰子
取正整数n。
连续掷一个六面骰子n次,记c是连续两次掷出同样点数的次数。
例如,如果n = 7,掷出的点数分别是(1,1,5,6,6,6,3),那么如下几组是连续两次掷出同样的点数:
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
因此,对于(1,1,5,6,6,6,3)来说,c = 3。
记C(n)是当连续掷一个六面骰子n次时,连续两次掷出同样点数的次数c不超过π(n)的结果数。1
例如,C(3) = 216,C(4) = 1290,C(11) = 361912500,而C(24) = 4727547363281250000。
对于1 ≤ n ≤ L,定义S(L)为∑ C(n)。
例如,S(50) mod 1 000 000 007 = 832833871。
求S(50 000 000) mod 1 000 000 007。
1 π表示的是素数计数函数,也就是说,π(n)表示 ≤ n的素数个数。