Define the function $ g(\cdot): \mathbb{Z} \to \{0,1\}$ such that $ g(n) = 0$ if $ n < 0$, and $ g(n) = 1$ otherwise. Define the function $ f(\cdot): \mathbb{Z} \to \mathbb{Z}$ such that $ f(n) = n - 1024g(n - 1024)$ for all $ n \in \mathbb{Z}$. Define also the sequence of integers $ \{a_i\}_{i \in \mathbb{N}}$ such that $ a_0 = 1$ e $ a_{n + 1} = 2f(a_n) + \ell$, where $ \ell = 0$ if $ \displaystyle \prod_{i = 0}^n{\left(2f(a_n) + 1 - a_i\right)} = 0$, and $ \ell = 1$ otherwise. How many distinct elements are in the set $ S: = \{a_0,a_1,\ldots,a_{2009}\}$? (Paolo Leonetti)
Problem
Source: Own (Oliforum contest 2009, round 2/ 5)
Tags: function, logarithms, combinatorics proposed, combinatorics
19.10.2009 09:51
A cute typo Quote: ... such that $ a_0 = 1$ e $ a_{n + 1} = 2f(a_n) + \ell$, where ... It seems that everybody speaks Italian, so they figured out that the "e" means "and" (not the base of natural logarithms)
19.10.2009 13:26
LOL, sorry for the mistake..Anyway, I have not yet read solutions, has anyone completely solve this one?
19.10.2009 21:24
Consider the obvious bijection between {1,...,2048} and the strings of 11 binary digits. The problem states that we begin with $ x_1: = 1$, and that if $ x_n = 0\ell$ or $ x_n = 1\ell$ (where $ \ell$ is a string of 10 binary digits) then $ x_{n + 1} = \ell 1$ if we can find i<n+1 such that $ x_i = \ell$, otherwise $ x_{n + 1} = \ell 0$. Define $ k: = \max\{n \in \mathbb{N}: \prod_{1 \le a < b \le n}{(x_a - x_b)} \neq 0\}$ and $ S: = \{x_1,...,x_k\}$. Suppose that $ x_k = ey$ for some e in {0,1} and a string y of 10 binary digits, then $ x_{k + 1} = y0 \in S$ by definition of k, so define $ x_i: = y0 \in S$ the other i such that 1<i<k+1. And, if $ x_k = ey$ then define j that integer such that 0<j<k+1 and $ x_j: = y1 \in S$ (it must exist since $ x_{k + 1} = y0$). If j>1 then $ \{x_{i - 1},x_{j - 1}\}$ exist and is $ \{0y,1y\}$, then $ x_k \in \{x_{i - 1},x_{j - 1}\}$, contradiction, so j=1. It means that $ 0 = y \in S$, and if $ e = 1$ then $ x_{k - 1} \in \{0,x_k\}$, contradiction, so $ x_k = 0$. Clearly $ 1 \le k \le 2048$; suppose that $ k < 2048$. A number $ a \in \{0,1\}$ and a string $ b$ of 10 binary digits exist such that $ ab \not \in S$, and suppose $ b0 \in S$ (clearly $ b \neq 0$).Define $ x_w: = b0 \in S$ for some 1<w<k+1, then there exist 0<z<k+1 such that $ x_z = b1 \in S$. As before if z>1 then $ \{x_{w - 1},x_{z - 1}\}$ exist and is $ ab \in \{0b,1b\} \subseteq S$, contradiction; and if z=1 then b=0, again contradiction. So a number $ ab$ does not belong to S only if $ b0 \not \in S$. But in this way we can define a sequence of number that do not belong to S, and that is eventually null, but $ a_k = 0$. It shows that $ \prod_{0 \le i < j \le 2047}{(a_i - a_j)^2} > 0$.[]