Find all cluster points of the following sequence This is a problem in Analysis I by Herbert Amann and Joachim Escher
Problem For $n\in\mathbb{N}$, define $$a_n:=n+\frac{1}{k}-\frac{k^2+k-2}{2}$$ where $k\in\mathbb{N}\backslash\{0\}$ satisfies $$k^2+k-2\le 2n\le k^2+3k-2$$ Show that $(a_n)$ is well-defined and determine all cluster points of $(a_n)$. (Hint: Calculate the first few terms of the sequence explicitly to understand the complete sequence).
Attempt To show $(a_n)$ is well defined, we tried solving the inequality. I got $$\frac{1}{2}(\sqrt{8n+17}-3)\le k \le\frac{1}{2}(\sqrt{8n+9}-1)$$
I tried this for the first 15 terms, $k=1$ for $n=1$, $k=2$ for $n={2,3,4}$,$k=3$ for $n=5,6,7,8$ and so on...I don't know what to do to next to prove rigorously the pattern I observed. As for cluster points, I guess is $\mathbb{N}$, but I don't know how to justify it.
 A: $\mathtt{Welldefinedness}:$$${1\over 2}(\sqrt{8n+9}-1)-{1\over 2}(\sqrt{8n+17}-3)=1-{4\over \sqrt{8n+9}+\sqrt{8n+17}}<1$$ $\therefore k$ can't have $2$ different natural values for any $n$ i.e. ${a_n}$ is well-defined.
Edit: This only proves uniqueness of $k$, for existence see this answer.  
For the rest of the discussion $N$ is a non-negative integer.
$\mathtt{Claim0}:\color{blue}{k(n+1)\in\{k(n),k(n)+1\}}\;\mathtt{ Proof:}$
$${1\over 2}(\sqrt{8(n+1)+9}-1)-{1\over 2}(\sqrt{8n+17}-3)=1
\Rightarrow |k(n+1)-k(n)|\le 1$$
Suppose $k(n+1)=k(n)-1.$
$${1\over 2}(\sqrt{8n+9}-1)-1\ge k(n)-1=k(n+1)\ge{1\over 2}(\sqrt{8(n+1)+17}-3)\Rightarrow 9\ge25
$$
$\mathtt{Claim1:}\color{blue}{f(n)={1\over 2}(n+9)(n+12)\Rightarrow k(f(n))=n+10}
\;\mathtt{Proof}:$ 
$${1\over2}(\sqrt{8f(n)+9}-1)=(n+10.5)-0.5=n+10$$
$\mathtt{Claim 2:}\color{blue}{f(n+1)>f(n)+N\Rightarrow k(f(n)+N)=n+10}\;\mathtt{Proof:}$
$$k(f(n))\le k(f(n)+N)\le{1\over2}(\sqrt{8(f(n)+N)+9}-1)<{1\over2}(\sqrt{8f(n+1)+9}-1)=n+11$$
$\mathtt{Claim 3:}\color{blue}{\lim_{n\to\infty} a_{f(n)+N}=N }\;
\mathtt{Proof:}$ 
So for sufficiently large $n$ we have$$
a_{f(n)+N}=f(n)+N+{1\over k(f(n)+N)}-{(k(f(n)+N)+2)(k(f(n)+N)-1)\over2}=f(n)+N+{1\over n+10}-{(n+12)(n+9)\over2}=f(n)+N+{1\over n+10}-f(n)=N+{1\over n+10}$$
As as $\lim_{n\to\infty} k(n)=0$, any subsequence of $\{a_n\}$ that converges is asymptotically equal to $n-{(k^2+k-2)\over2}=n+1-{k(k+1)\over2}$ which is an integer sequence. So cluster points can't be non-integer valued. $a_n>{1\over k}\Rightarrow$ cluster points can't be negative. So by claim $3$ the set of cluster points is $\mathbb{N}\cup\{0\}$. Here's a scatter plot for $\{a_n\}$

