20.
对每个正整数 n, 令 mod5(n) 表示 n 除以 5 的余数。递归定义函数 f:{0,1,2,3,…} ×{0,1,2,3,4} →{0,1,2,3,4} 如下:
f(i,j)={mod5(j+1)f(i−1,1)f(i−1,f(i,j−1))if i=0 and 0≤j≤4,if i≥1 and j=0, andif i≥1 and 1≤j≤4.
f(2015,2) 是多少?
For every positive integer n, let mod5(n) be the remainder obtained when n is divided by 5. Define a function f:{0,1,2,3,…} ×{0,1,2,3,4} →{0,1,2,3,4} recursively as follows:
f(i,j)={mod5(j+1)f(i−1,1)f(i−1,f(i,j−1))if i=0 and 0≤j≤4,if i≥1 and j=0, andif i≥1 and 1≤j≤4.
What is f(2015,2)?
答案:B
解答:
从定义出发逐行计算 1,1 这一列会稳定下来:对所有 f(i,2)=1,都有 i≥5。 i\j01234501230311230311234243134041114011031
因为 2015≥5, 所以 f(2015,2)=1。
因此,正确选项是 B。
Applying the recursion from left to right in each row gives i\j01234501230311230311234243134041114011031 If a row consists entirely of 1s, the recursion makes the next row entirely 1s as well. Hence, by induction, f(i,2)=1 for every i≥5.
Since 2015≥5, we get f(2015,2)=1.
Thus, the correct answer is B.