Problem 419
Look and say sequence
The look and say sequence goes 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, …
The sequence starts with 1 and all other members are obtained by describing the previous member in terms of consecutive digits.
It helps to do this out loud:
1 is ‘one one’ → 11
11 is ‘two ones’ → 21
21 is ‘one two and one one’ → 1211
1211 is ‘one one, one two and two ones’ → 111221
111221 is ‘three ones, two twos and one one’ → 312211
…
Define A(n), B(n) and C(n) as the number of ones, twos and threes in the n’th element of the sequence respectively.
One can verify that A(40) = 31254, B(40) = 20259 and C(40) = 11625.
Find A(n), B(n) and C(n) for n = 1012.
Give your answer modulo 230 and separate your values for A, B and C by a comma.
E.g. for n = 40 the answer would be 31254,20259,11625
看图说话序列
看图说话序列是这样一个序列:1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, …
这个序列从1开始,之后所有的项都是通过描述前一项的连续数字得到的。
把过程详细地说明一下有助于对这个序列的理解:
1是“1个1 → 11
11是“2个1” → 21
21是“1个2和1个1” → 1211
1211是“1个1,1个2和2个1” → 111221
111221是“3个1,2个2,1个1” → 312211
…
记A(n),B(n)和C(n)分别表示第n项元素中数字1、2、3的数目。
可以验证A(40) = 31254,B(40) = 20259,而C(40) = 11625。
对于n = 1012,求A(n),B(n)和C(n)。
将你的答案模230取同余,并用逗号分隔开A,B和C。
例如,对于n = 40,答案应当是31254,20259,11625。