Problem

Source: OLCOMA Costa Rica National Olympiad, Final Round, 2014 3.5

Tags: algebra, functional equation, functional, recurrence relation



Let $f : N\to N$ such that $$f(1) = 0\,\, , \,\,f(3n) = 2f(n) + 2\,\, , \,\,f(3n-1) = 2f(n) + 1\,\, , \,\,f(3n-2) = 2f(n).$$Determine the smallest value of $n$ so that $f (n) = 2014.$