Solution by jasperE3.
f(2f(x)f(y))=2f(x)f(y).
Let ∅=S⊆R be any set with the closure property that if a,b∈S then 2ab∈S. Then we claim that all solutions are of the form:
f(x)={xg(x)if x∈Tif x∈/T
where T={2ab∣a,b∈S} and g:R∖T→S is any function.
All such functions work: we can first see that f(x)∈S for all x whether x∈T or x∈/T, then that 2f(x)f(y)∈T for all x,y∈R so f(2f(x)f(y))=2f(x)f(y) as desired.
To show that all functions with f(2f(x)f(y))=2f(x)f(y) are of this form, define S=f(R) and note that S has the aforementioned closure property that 2f(x)f(y)∈S. It’s clear that f(x)=x for x∈T, and that f(x)∈S for x∈/T, hence the result.
For instance, with S={2n∣n∈N} and g(x)=2⌊∣x∣⌋+1 we have f(x)={x2⌊∣x∣⌋+1if x=2n,3≤n∈Notherwise.