find all continuous function $f:\mathbb{R} \to \mathbb{R}$ such that : $f\left(x\right)-f\left(y\right) \in\mathbb{Q} \iff (x-y) \in \mathbb{Q}$
Some answer is $f(x)= x+b$ also we have :
$$\underset{n\text{ times}}{\underbrace{f \circ f \circ f \circ f\circ f \circ \cdots\circ f}}(x)-\underset{n\text{ times}}{\underbrace{f \circ f \circ f \circ f\circ f \circ \cdots\circ f}}(y)\in\mathbb{Q} $$
The answer given is not correct. If $f(x)=cx+b$ where $c$ is a non-zero rational number then the hypothesis is satisfied.
To show that $f(x)$ must be of the type $cx+b$ we may suppose $f(0)=0$ (by considering $f(x)-f(0)$). In this case $f(x+r)-f(x)$ is a rational number for all $x$ whenever $r$ is rational. By IVP of continuous functions it follows that this function is a constant. Hence $f(x+r)-f(x)=f(r)-f(0)=f(r)$ which means $f(x+r)=f(x)+f(r)$. By continuity of $f$ it follows that this equation holds even if $r$ is irrational. Hence $f$ is a continuous additive function. This implies $f(x)=Cx$ for some constant $C$. Clearly, $C$ must be a rational number