# Find the value of $\int_0^1 g$ such that $g(x)=\sum_{n\ge 1}f_n(x)$, with $f_n(x)=2^{1-2n}\lfloor 2^{n-1}x+1/2\rfloor$

Find the value of $\int_0^1 g$ such that $g(x)=\sum_{n\ge 1}f_n(x)$, with $f_n(x)=2^{1-2n}\lfloor 2^{n-1}x+1/2\rfloor$

I need to use only Riemann integration. I want to check if my result is correct.

1. $\sum f_n\to g$ uniformly on $[0,1]$ because we have that $1/2^n\ge f_n(x)$ in $[0,1]$ and $\sum_{n\ge 1} 1/2^n=1$

2. The set of discontinuities for some $f_n$ is $D_n=\{\frac{2k-1}{2^n}:k\in\Bbb N\land 2k-1<2^n\}$, and we have that $D_n\cap D_m=\emptyset$ if $n\neq m$

Because $\sum f_n$ converges uniformly then

$$\int_0^1g(x)\mathrm dx=\int_0^1\sum_{n\ge1}2^{1-2n}\lfloor 2^{n-1}x+1/2\rfloor\mathrm dx=\sum_{n\ge1}2^{1-2n}\int_0^1\lfloor 2^{n-1}x+1/2\rfloor\mathrm dx$$

and $f_n$ is a constant function in the intervals $[\frac{2k-1}{2^n},\frac{2k-1}{2^n})$, $[0,1/2^n)$ and $[\frac{2^n-1}{2^n},1]$ due to the set of discontinuities $D_n$.

Then

$$\int_0^1\lfloor 2^{n-1}x+1/2\rfloor\mathrm dx=\int_0^{1/2^n}0\mathrm dx+\int_{\frac{2^n-1}{2^n}}^{1}2^{n-1}\mathrm dx+\sum_{k=1}^{2^{n-1}-1}\int_{\frac{2k-1}{2^n}}^{\frac{2k+1}{2^n}}k\mathrm dx=\\=\frac12+\frac{2^{n-1}-1}{2}=2^{n-2}$$

and finally

$$\int_0^1g(x)\mathrm dx=\sum_{n\ge1}\frac{2^{n-2}}{2^{2n-1}}=\frac12$$

My questions:

1. Are my calculations right?

2. There is an easy way to approach this problem just using at most the integral of Riemann?