If $$f(x) = \begin{cases}18-x^2 &x<2 \\x^2+2x+7 &x\geq2 \end{cases}$$
Find a sequence such that $x_n\to2$ and $f(x_n)\not\to f(2)$
I found a definition that says $f:(a, b) \to \mathbb{R}$ is defined on an open interval then $f$ is continuous iff $\displaystyle\lim_{x\to c} f(x) =f(c)\: \text{for}\: a < c < b$ since every point is an accumulation point.
So I know that it there is a function where $x_n\to2$ and $f(x_n) \not\to f(2)$ since the $f(x)$ is not continuous at 2 but I have no idea what this function would be. As an attempt I tried $x_n=(2+\frac1n)$ since its limit is $2$ but this did not look correct. Any help appreciated
Let $x_{n}:=2-\frac{1}{n}$. Then, for each $n$, $x_{n}< 2$, so
$$ f(x_{n})=18-\left(2-\frac{1}{n}\right)^{2}=18-4+\frac{4}{n}-\frac{1}{n^{2}}\to 14\qquad\text{as }n\to\infty. $$
But, $f(2)=15$.