# Find $\sum_{n=1}^\infty\frac{2^{f(n)}+2^{-f(n)}}{2^n}$, where $f(n)=\left[\sqrt n +\frac 12\right]$ denotes greatest integer function

Question: Let $$f(n)=\left[\sqrt n +\dfrac 12\right]$$, where $$[\cdot]$$ denotes greatest integer function, $$\forall n\in \Bbb N$$. Then, $$\sum_{n=1}^\infty\frac{2^{f(n)}+2^{-f(n)}}{2^n}={\color{red}?}$$

My solution : I tried with trapping gif function into its lower value and upper values using $$x-1< [x] , but i am not getting any result.

Note that $$f(n) = \left\lfloor \sqrt{n}+\tfrac{1}{2}\right\rfloor = k$$ iff $$k^2-k+\tfrac{1}{4} \le n < k^2+k+\tfrac{1}{4}$$, i.e. $$k^2-k+1 \le n \le k^2+k$$.
\begin{align*} \sum_{n = 1}^{\infty}\dfrac{2^{f(n)}+2^{-f(n)}}{2^n} &= \sum_{k = 1}^{\infty}\sum_{f(n) = k}\dfrac{2^{f(n)}+2^{-f(n)}}{2^n} \\ &= \sum_{k = 1}^{\infty}\sum_{n = k^2-k+1}^{k^2+k}\dfrac{2^k+2^{-k}}{2^n} \\ &= \sum_{k = 1}^{\infty}(2^k+2^{-k})\cdot\sum_{n = k^2-k+1}^{k^2+k}\dfrac{1}{2^n} \\ &= \sum_{k = 1}^{\infty}(2^k+2^{-k})\left(2^{-(k^2-k)}-2^{-(k^2+k)}\right) \\ &= \sum_{k = 1}^{\infty}\left(2^{-k^2+2k}+2^{-k^2}-2^{-k^2}-2^{-k^2-2k} \right) \\ &= \sum_{k = 1}^{\infty}\left(2^{-(k-1)^2+1} - 2^{-(k+1)^2+1}\right) \\ &= \sum_{i = 0}^{\infty}2^{-i^2+1} - \sum_{j = 2}^{\infty}2^{-j^2+1} \\ &= 2^{-0^2+1}+2^{-1^2+1} \\ &=3 \end{align*}