Prove or disprove Riemann-integrability (I guess there are uncountably many points of discontinuity) Consider the function defined by
$$
f(x)=\begin{cases}0, & x=0\\1, & \textrm{ if }\lfloor\frac{1}{x}\rfloor\textrm{ is even}\\-1, & \textrm{ if }\lfloor\frac{1}{x}\rfloor\textrm{ is odd}\end{cases}
$$
(Here $\lfloor x\rfloor=\max\{k\in\mathbb{Z}: k\leq x\}$ is the floor function.)
Prove or disprove that $f$ is Riemann-integrable on $[0,2]$.

My first observation is that
$$
\left\lfloor\frac{1}{x}\right\rfloor=\begin{cases}0, & x>1\\1, & x=1\end{cases}~\implies f(x)=\begin{cases}1, & x\in(1,2]\\-1, & x=1\end{cases}
$$
so on $[1,2]$ $f$ has finitely many points of discontinuity and thus Riemann-integrable.
It remains to consider $f$ on $[0,1)$.
There are  at least countably many points of discontinuity in $[0,1)$, namely, for example,
$x=\frac{1}{k}, k\geq 2$
since
$$f\left(\frac{1}{k}\right)=\begin{cases}1, & k\geq 2\textrm{ and }k\textrm{ even}\\-1, & k\geq 2\textrm{ and }k\textrm{ odd }\end{cases}$$
But my feeling is that there are even uncountably many points of discontinuity in $[0,1)$ which probably has something to do with the fact that there are uncountably many irrational numbers in $[0,1)$.
 A: $f$ is a constant on each interval of the type $(\frac 1 n, \frac 1 {n+1})$ and hence it is continuous on each of these.  The only points of dis-continuity are the end points of these intervals which are countable in number. Hence, $f$ is Riemann integrable.
A: That function has countably many discontinuity points ($0$ and the points of the form $\frac1n$, with $n\in\Bbb N$). And there is a theorem due to Lebesgue which tells that if the set of points of discontinuity of a bounded function $f\colon[a,b]\longrightarrow\Bbb R$ has Lebesgue measure $0$, then $f$ is Riemann-integrable. So, since every countable set has Lebesgue measure $0$, your function is Riemann-integrable.
But you can prove it without usinge that theorem. Take $\varepsilon>0$. Since the restriction of $f$ to $\left[\frac\varepsilon4,2\right]$ is Riemann-integrable, there is a partition $P$ of $\left[\frac\varepsilon4,2\right]$ such that $\overline\sum\left(f|_{[0,\varepsilon/4]},P\right)-\underline\sum\left(f|_{[0,\varepsilon/4]},P\right)<\frac\varepsilon2$. Now, let $Q=P\cup\{0\}$. Then $Q$ is a partition of $[0,2]$ and$$\overline\sum(f,Q)=1\times\frac\varepsilon4+\overline\sum(f,P)$$and$$\underline\sum(f,Q)=(-1)\times\frac\varepsilon4+\underline\sum(f,P),$$and therefore\begin{align}\overline\sum(f,P)-\underline\sum(f,P)&=\frac\varepsilon2+\overline\sum\left(f|_{[0,\varepsilon/4]},P\right)-\underline\sum\left(f|_{[0,\varepsilon/4]},P\right)\\&<\varepsilon.\end{align}
