Claim: The only functions that satisfy this are

Proof: We make the following observations

1.

2.

3. It follows by induction that

4.

5.

So, clearly we have that

and since is dense in we see that given any there exists a sequence of rational numbers such that and since is continuous .

The conclusion follows.