Funky Functional Equation

Algebra Level 5

Let $f:\mathbb{R^+} \rightarrow \mathbb{R^+}$ be a function satisfying

$f(1)=2$

$f(2)=1$

$f(3n)=3f(n)$

$f(3n+1)=3f(n)+2$

$f(3n+2)=3f(n)+1.$

Find the number of integers $n \leq 2006$ such that $f(n)=2n.$

See Part 2 if you enjoyed this problem! :D

×