BMO/BMO
2011 British Mathematical Olympiad
10 道题目
British Mathematical OlympiadRound 1Round 2
选择题目
点击题号切换,正文区一次只显示一道题
3. The function $f$ is defined on the positive integers as follows;
$$ \begin{aligned} f(1)&=1;\\ f(2n)&=f(n) && \text{if } n \text{ is even};\\ f(2n)&=2f(n) && \text{if } n \text{ is odd};\\ f(2n+1)&=2f(n)+1 && \text{if } n \text{ is even};\\ f(2n+1)&=f(n) && \text{if } n \text{ is odd}. \end{aligned} $$
Find the number of positive integers $n$ which are less than $2011$ and have the property that $f(n)=f(2011)$.
$$ \begin{aligned} f(1)&=1;\\ f(2n)&=f(n) && \text{if } n \text{ is even};\\ f(2n)&=2f(n) && \text{if } n \text{ is odd};\\ f(2n+1)&=2f(n)+1 && \text{if } n \text{ is even};\\ f(2n+1)&=f(n) && \text{if } n \text{ is odd}. \end{aligned} $$
Find the number of positive integers $n$ which are less than $2011$ and have the property that $f(n)=f(2011)$.
考场第一眼 / First look
不要逐个递归计算 \(f(n)\),而要观察把一个二进制位添到末尾时发生了什么。若新位与原末位相同,题设让 \(f\) 不变;若两位不同,题设恰好把这个新位添到 \(f(n)\) 的二进制表示末尾。因此,\(f\) 的作用就是把二进制串中每一段连续相同的数字压缩成一个数字。先压缩 \(2011\) 的二进制表示,再把所有产生同一压缩串的整数写成五段正长度的游程。真正容易漏掉的是 11 位整数不一定小于 \(2011\),所以最后一层必须按二进制字典序单独截断。