Problem

Source: 2024 KJMO P8

Tags: function, algebra



$f$ is a function from the set of positive integers to the set of all integers that satisfies the following. $\cdot$ $f(1)=1, f(2)=-1$ $\cdot$ $f(n)+f(n+1)+f(n+2)=f(\left\lfloor\frac{n+2}{3}\right\rfloor)$ Find the number of positive integers $k$ not exceeding $1000$ such that $f(3)+f(6)+\cdots+f(3k-3)+f(3k)=5$.