MathDB
Number of distinct element in {a_0,...,a_2009}

Source: Own (Oliforum contest 2009, round 2/ 5)

October 18, 2009
functionlogarithmscombinatorics proposedcombinatorics

Problem Statement

Define the function g():Z{0,1} g(\cdot): \mathbb{Z} \to \{0,1\} such that g(n) \equal{} 0 if n<0 n < 0, and g(n) \equal{} 1 otherwise. Define the function f():ZZ f(\cdot): \mathbb{Z} \to \mathbb{Z} such that f(n) \equal{} n \minus{} 1024g(n \minus{} 1024) for all nZ n \in \mathbb{Z}. Define also the sequence of integers {ai}iN \{a_i\}_{i \in \mathbb{N}} such that a_0 \equal{} 1 e a_{n \plus{} 1} \equal{} 2f(a_n) \plus{} \ell, where \ell \equal{} 0 if \displaystyle \prod_{i \equal{} 0}^n{\left(2f(a_n) \plus{} 1 \minus{} a_i\right)} \equal{} 0, and \ell \equal{} 1 otherwise. How many distinct elements are in the set S: \equal{} \{a_0,a_1,\ldots,a_{2009}\}? (Paolo Leonetti)