Let $g: [0,1] \rightarrow \mathbb R$ and $g(x)=\frac{1}{q}$ if $x=\frac{p}{q} $ otherwise $0$.Prove that g is Riemann integrable.
Hint: Analyze the discontinuities of $g$. Prove that if $x$ is irrational and if $\frac{p_n}{q_n}$ is a sequence of rationals converging to $x$, then $q_n \rightarrow \infty$.
My idea: I observe that this function has countably many discontinuities. If I prove that If a function has countably many discontinuity then it is Riemann integrable. Is this direction is right?
Anyone suggest some idea from the hint?