Maths Olympiad Prep

Track / Stage 6 / 400 of 400 #1400 of 1964

Problem 1400

National Olympiad, first round
Algebra Difficulty 7.0 Prove it Olimpiada Matemática Española (Concurso Final) · Mexico

We consider the sequence of integers {f(n)}n=1\{f(n)\}_{n=1}^{\infty} defined by:
* f(1)=1f(1) = 1.
* If nn is even, f(n)=f(n/2)f(n) = f(n/2).
* If n>1n > 1 is odd and f(n1)f(n-1) is odd, then f(n)=f(n1)1f(n) = f(n-1) - 1.
* If n>1n > 1 is odd and f(n1)f(n-1) is even, then f(n)=f(n1)+1f(n) = f(n-1) + 1
a) Calculate f(220201)f(2^{2020} - 1).
b) Prove that {f(n)}n=1\{f(n)\}_{n=1}^{\infty} is not periodic, that is, there do not exist positive integers tt and n0n_0 such that f(n+t)=f(n)f(n+t) = f(n) for every nn0n \ge n_0.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

First of all, we note that the sequence is well defined: for each nNn \in \mathbb{N}, n>1n > 1, the value of f(n)f(n) is perfectly determined from the values of f(r)f(r) with r<nr < n.
We consider the sequence g(n)g(n) given by g(n)=0g(n) = 0 if the binary expression of nn has an even number of ones; and g(n)=1g(n) = 1 if the binary expression of nn has an odd number of ones. It is obvious that gg satisfies all the conditions that define ff, hence f(n)=g(n)f(n) = g(n) for every nNn \in \mathbb{N}.
Thus, since 2202012^{2020} - 1 is written in binary with 2020 ones,
f(220201)=0 f(2^{2020} - 1) = 0
Finally, let us see that the sequence is not periodic. Suppose that it were, from a value n0n_0 onward and with period tt. We take the integer, rr, such that 2rt<2r+12^r \le t < 2^{r+1}. We observe that the binary expression of 2r+t2^r + t is obtained by replacing the first 1 (from the left) of the expression of tt with the two digits 10, so that f(2r+t)=f(t)f(2^r + t) = f(t). We take an integer k>r+1k > r + 1 such that 2k>n02^k > n_0. Now, we have:
If f(t)=1f(t) = 1, then f(2k+t)=0f(2^k + t) = 0 and therefore, f(2k+t)f(2k)=1f(2^k + t) \ne f(2^k) = 1.

If f(t)=0f(t) = 0, then f(2k+2r+t)=1+f(2r+t)=1+f(t)=1f(2^k + 2^r + t) = 1 + f(2^r + t) = 1 + f(t) = 1 and therefore, f(2k+2r+t)f(2k+2r)=0f(2^k + 2^r + t) \neq f(2^k + 2^r) = 0.

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from es; metadata (topic, difficulty, ordering) added by this project.