Conjecture: Let $f: \mathbb R \to \mathbb R$ be an everywhere differentiable function and assume that $f'(x) \in \mathbb Z$ almost everywhere. Then is $f$ necessarily an affine function?
Can you give me a proof or a counter-example ? I thought of the devil's staircase, but this is not differentiable everywhere.