I have the following problem:

**For any positive integer n, let $\langle n \rangle$ denote the integer nearest to $\sqrt n$.**

**(a) Given a positive integer $k$, describe all positive integers $n$ such that $\langle n \rangle = k$.**

**(b) Show that $$\sum\_{n=1}^\infty{\frac{2^{\langle n \rangle}+2^{-\langle n \rangle}}{2^n}}=3$$**

**My progress:** The first one is rather easy. As $$\left( k-\frac{1}{2} \right) < \sqrt n < \left( k+\frac{1}{2} \right) \implies \left( k-\frac{1}{2} \right)^2 < n < \left( k+\frac{1}{2} \right)^2 \implies \left( k^2-k+1 \right) \leq n \leq \left( k^2+k \right)$$
Actually, there would be $2k$ such integers.

But, I have no idea how to approach the second problem. Please give me some hints.