A function $f$ is defined on $[0,1]$ such that for every
- irrational number in $[0,1]$, $f(x)=1$ and
- rational number in $[0,1]$, $f(x) = \dfrac{a-2}{a}$, where $a$ is the smallest natural number for which $ax$ is an integer.
Does $\int_0^1 f(x)dx$ exist? If yes, what's the value?
I have a hunch that it is not integrable, but somehow unable to proceed.