Find a monotonously increasing function in the interval $[0,1]$ that is discontinuous at every point$ (x=1/n), n=[2,3...\infty]$ As part of some exercise I've been given, we're supposed to identify a function that has the following properties:


*

*Defined on the interval $ [0,1]$ 

*Monotonously increasing

*Discontinuous, at every point $x\in\{1/n\}, n=(2,3,...\infty)$ 


I'm also supposed to show how it is Riemann-integrable. I'm honestly stumped as to how to produce such a function. My first attempt was to define it piecewise as $f(x)=1,x\neq1/n, f(x)=0,x=1/n,$ but that's not a monotonously increasing function. 
As far as I've understood with some further reading, you can only have a countable amount of discontinuities for a monotonously increasing function - but I'm tasked with finding one with an infinite amount of discontinuities, so I don't know what I've misunderstood. I can sort of make a picture in my head of a function that jumps up a little at points where $x=1/n$ but I haven't the slightest clue how to define one like it.
 A: For each $n\in\mathbb{N}$, you can define a function $j_n$ by
$$ j_n(x) = \begin{cases}
0 & \text{if $x < \frac{1}{n}$, and} \\
1 & \text{if $x \ge \frac{1}{n}$.}
\end{cases} $$
(I am calling these functions $j_n$ because they jump at $\frac{1}{n}$.)  Then define the function $f$ by
$$ f(x) = \sum_{n=1}^{\infty} \frac{1}{2^n} j_n(x). $$
Observe that $f$ converges pointwise on the interval $[0,1]$.  Indeed, with $N = \left\lceil \frac{1}{x} \right\rceil$, we have
$$ N
= \left\lceil \frac{1}{x} \right\rceil
\ge \frac{1}{x}
\ge \left\lfloor \frac{1}{x} \right\rfloor > N-1
\implies \frac{1}{N-1} > x \ge \frac{1}{N},$$
from which it follows (modulo a possible off-by-one indexing error, though I'm pretty sure I kept track sufficiently well) that
$$ f(x) = \sum_{n=1}^{N} \frac{1}{2^n}, $$
which can be computed explicitly (it is a geometric series).  The intuition here is that this is a function that is constant on each interval $\left[ \frac{1}{n+1}, \frac{1}{n} \right)$, then jumps up by $\frac{1}{2^n}$ at $x = \frac{1}{n}$.
It is hopefully not to hard to see that this function is discontinuous at every point of the form $\frac{1}{n}$ (with $n\in\mathbb{N}$, thus there are a countably infinite number of discontinuities), and it is not too hard to show that it is nondecreasing.  You can then compute the integral by noting that
$$ \int_{0}^{1} f(x) \,\mathrm{d}x
= \sum_{n=1}^{\infty} \int_{\frac{1}{n+1}}^{\frac{1}{n}} f(x) \, \mathrm{d}x
= \sum_{n=1}^{\infty} \int_{\frac{1}{n+1}}^{\frac{1}{n}} \sum_{k=1}^{n} \frac{1}{2^k} \, \mathrm{d}x. $$
(Exercise:  do this explicitly.)
If you need a function that is strictly increasing, consider
$$ g(x) = x + f(x), $$
where $f$ is the function defined above.
