Problem

Source: IMO Shortlist 1996, A9

Tags: floor function, modular arithmetic, algebra, Sequence, recurrence relation, IMO Shortlist



Let the sequence $ a(n), n = 1,2,3, \ldots$ be generated as follows with $ a(1) = 0,$ and for $ n > 1:$ \[ a(n) = a\left( \left \lfloor \frac{n}{2} \right \rfloor \right) + (-1)^{\frac{n(n+1)}{2}}.\] 1.) Determine the maximum and minimum value of $ a(n)$ over $ n \leq 1996$ and find all $ n \leq 1996$ for which these extreme values are attained. 2.) How many terms $ a(n), n \leq 1996,$ are equal to 0?