Assume $f\left({\frac{f(x)}{x}}\right)= f(x)$. Show that $ f$ continuous 
Let $f : (0, \infty) \to (0, \infty)$ be a function that has primitives (that is, there is $F$ so that $F' = f$) and satisfies the relation $$f\left(\displaystyle{\frac{f(x)}{x}}\right)= f(x) , \forall x \in (0, \infty)$$ Prove that $f$ is continuous.

I tried to obtain something with repeated substitutions and use the fact that if $f$ has primitives then I can use the intermediate value theorem, but I didn't manage to solve it.
Remark this question is found in a Romanian mathematics magazine called "Gazeta matematica".
 A: Using @md2perpe's comment, let $g: (0, \infty) \to (0, \infty), g(x) = \displaystyle{\frac{f(x)}{x}}$. The equation from the hypothesis becomes $g(g(x)) = x, \forall x \in (0, \infty)$. Note that $g$ is bijective.
But, because $f$ has primitives and $ h : (0,\infty)→(0,\infty),h(x)=x$ also has primitives, then we know that $\displaystyle{\frac{f}{h}}$ has the intermediate value property$(*)$, so $g$ has the intermediate value property. 
Now, because $g$ is bijective and has the intermediate value property, $g$ is continuous. Therefore $f(x) = xg(x)$ is continuous.
$(*)$I only need to show now that $\displaystyle{\frac{f}{h}}$ has the intermediate value property. This is true because of one of Jarnik's propositions. That is:
Let $f,g : [a,b] \to \mathbb{R}$ be two differentiable functions on $[a,b]$ and $g'(x) \neq 0, \forall x \in [a,b]$. Then $h = \displaystyle{\frac{f'}{g'}}$ has the intermediate value property.
Proof:
Evidently, $g'(a)$ and $g'(b)$ have the same sign. If they don't, then because $g'$ has the intermediate value property, there exists $c \in [a,b]$ such that $g'(c) = 0$, so we obtain a contradiction.
Now let $\lambda$ be an intermediate value between $\displaystyle{\frac{f'(a)}{g'(a)}}$ and $\displaystyle{\frac{f'(b)}{g'(b)}}$.
Let $F : [a,b] \to \mathbb{R}, F(x) = f(x) - \lambda g(x)$. 
Evidently $F$ is differentiable, $F'(a) = g'(a) \left (\displaystyle{\frac{f'(a)}{g'(a)} - \lambda}\right)$ and $F'(b) = g'(b) \left (\displaystyle{\frac{f'(b)}{g'(b)} - \lambda}\right)$, so $F'(a)$ and $F'(b)$ have different signs, therefore there exists $d \in [a,b]$ such that $F'(d) = 0$, so we are done.
