$\lfloor\frac12+\frac1{2^2}+\frac1{2^3}+\cdots\rfloor\;$ vs $\;\lim_{n\to\infty}\lfloor\frac12+\frac1{2^2}+\cdots+\frac1{2^n}\rfloor$

The difference the difference between $\lim\limits_{n\to \infty} f(g(n))$ and $f(\lim\limits_{n\to \infty}g(n))$.

In $\lim _{n \rightarrow \infty} \Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\cdots+\frac{1}{(2)^{n}}\Bigg\rfloor \tag*{$ \space.....[2] $}$ you take a sum, floor it, then take the limits of the floors.

In $\Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\infty\Bigg\rfloor \tag*{$ \space.....[1] $}$ which can is defined as, and can be written as, $\Bigg\lfloor\lim\limits_{n\to \infty}(\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\frac{1}{(2)^{n}})\Bigg\rfloor \tag*{$ \space.....[1] $}$ you take a sum, find its limit and then floor it in the end.

Different things.

.......

$\lim _{n \rightarrow \infty} \Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\cdots+\frac{1}{(2)^{n}}\Bigg\rfloor \tag*{$ \space.....[2] $}=0$

Why? Because $0< \frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\cdots+\frac{1}{(2)^{n}} < 1 $ for all $n$. So $\Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\cdots+\frac{1}{(2)^{n}}\Bigg\rfloor \tag*{$ \space.....[2] $}=0$ for all $n$. So $\lim _{n \rightarrow \infty} \Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\cdots+\frac{1}{(2)^{n}}\Bigg\rfloor \tag*{$ \space.....[2] $}=\lim_{n\to \infty} 0 = 0$.

But $\Bigg\lfloor\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\infty\Bigg\rfloor \tag*{$ \space.....[1] $}$$=\Bigg\lfloor\lim\limits_{n\to \infty}(\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\frac{1}{(2)^{n}})\Bigg\rfloor \tag*{$ \space.....[1] $}=1$

Why?

Because $\lim\limits_{n\to \infty}\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\frac{1}{(2)^{n}}= \lim\limits_{n\to \infty} 1- \frac 1{2^{n}} = 1$. So $\Bigg\lfloor\lim\limits_{n\to \infty}(\frac{1}{2}+\frac{1}{(2)^{2}}+\frac{1}{(2)^{3}}+\frac{1}{(2)^{4}}+...\frac{1}{(2)^{n}})\Bigg\rfloor \tag*{$ \space.....[1] $}= \Bigg\lfloor 1 \Bigg\rfloor = 1$


The problem here is that we cannot simply exchange the limit and the function because the floor function is not continuous over $\mathbb R$.

Indeed we know that continuous functions map convergent sequences to convergent sequences. Therefore in that case we have: $$\lim\limits_{n\to \infty}f(a_n) = f(\lim\limits_{n\to\infty}a_n)$$ As @Jmoravitz remarked this does not have to hold for functions that fail to be continuous, e.g. in our case $f: \mathbb R \to \mathbb N$, defined by $f(x)=\lfloor x \rfloor$. Indeed by direct computation we recognise the geometric series: $$\left\lfloor\lim_{n \to \infty } \sum_{i=1}^n \frac{1}{2^i}\right\rfloor= \left\lfloor\sum_{i=1}^\infty \frac{1}{2^i} \right\rfloor= \left\lfloor\frac{1}{1-0.5}-1 \right\rfloor=1.$$ However, if we first floor the finite sum, we see that $0<\sum_{i=1}^n \frac{1}{2^i}< 1$ for all $n \in \mathbb N$. This is why we find: $$\lim_{n \to \infty } \left\lfloor \sum_{i=1}^n \frac{1}{2^i} \right\rfloor= \lim_{n \to \infty } 0=0.$$ We see that we cannot simply exchange the limit and "applying the function".