Let $ \def\nint#1{\langle #1\rangle}\nint x$ denote the integer closest to $\sqrt x$. This is ambiguous whenever $\sqrt x$ is a half-integer; fortunately such will not arise in the rest of this question, and we may simply take $\nint x = \left\lfloor \sqrt x+\frac12\right\rfloor$.
Now consider the sum $$S(k) = \def\nint#1{\langle #1\rangle} \sum_{i=1}^\infty \frac{k^{\nint i} + k^{-\nint i}}{k^i}$$
Computer calculations unequivocally suggest that $$S(k)=\frac{k+1}{k-1}$$ for all $k>1$; in particular $$S(2) = 3.$$ Is this correct, and if so, what is a proof? I imagine a counting argument that calculates the number $C_n$ of different $i$ at which the function $\nint i$ takes the value $n$, but I have not worked out the details. I would also be interested to see an argument about the region in which $S$ converges.
[ The $k=2$ case of this question has been asked at least twice 1 2 in the past couple of days, and closed both times, but I think it deserves more attention. ]