What are all functions $f:\mathbb{Z}\rightarrow\mathbb{Z}$ such that $f(a)-f(b)$ divides $a^3-b^3$ for all $a,b\in\mathbb{Z}$ such that $f(a)\neq f(b)$?
The constant functions satisfy vacuously, and both $f(x)=x+c$ and $f(x)=-x+c$ works for any $c\in\mathbb{Z}$. Same with $f(x)=x^3+c$ and $f(x)=-x^3+c$. Are there other such functions?
Edit: As Meelo pointed out, any function with range spanning only two consecutive integers works, since $\pm1$ divides everything.
What about $f(x)=x^3$?
${}{}{}{}{}{}{}{}{}{}{}{}{}$