0%

Problem 326


Problem 326


Modulo Summations

Let an be a sequence recursively defined by: $a_1=1, a_n=(\sum_{k=1}^{n-1}k·a_k) \text{ mod } n$.

So the first 10 elements of an are: 1,1,0,3,0,3,5,4,1,9.

Let f(N,M) represent the number of pairs (p,q) such that:

$$ 1 \le p \le q \le N \text{ and } (\sum_{t=p}^{q}a_i) \text{ mod } M=0$$

It can be seen that f(10,10)=4 with the pairs (3,3), (5,5), (7,9) and (9,10).

You are also given that f(104,103)=97158.

Find f(1012,106).


同余加和

数列an按如下方式递归定义:$a_1=1, a_n=(\sum_{k=1}^{n-1}k·a_k) \text{ mod } n$。

因此an的前10项分别是:1,1,0,3,0,3,5,4,1,9。

记f(N,M)为满足如下条件的数对(p,q)的数目:

$$ 1 \le p \le q \le N \text{ 且 } (\sum_{t=p}^{q}a_i) \text{ mod } M=0$$

可以看出f(10,10)=4,这4个数对分别是(3,3)、(5,5)、(7,9)和(9,10)。

此外还已知f(104,103)=97158。

求f(1012,106)。