Problem

Source: Oliforum Contest I 2008 2.2 https://artofproblemsolving.com/community/c2487525_oliforum_contes

Tags: floor function, algebra, function



Let $ \{a_n\}_{n \in \mathbb{N}_0}$ be a sequence defined as follows: $ a_1=0$, $ a_n=a_{[\frac{n}{2}]}+(-1)^{n(n+1)/2}$, where $ [x]$ denotes the floor function. For every $ k \ge 0$, find the number $ n(k)$ of positive integers $ n$ such that $ 2^k \le n < 2^{k+1}$ and $ a_n=0$.