continues function and sequence given that $f : D \to \mathbb{R}$ such that $D \subseteq \mathbb{R}$

and $a_n$ is convergent sequence such that for all $n$ , $a_n \in D$

then $f(a_n)$ is also a convergent sequence ?!

I think this is not true, for a counter-example i have $a_n = \frac{1}{n}$ and $f : (0,1] \to \mathbb{R}$ such that $f(x)=\frac{1}{x}$

$f$ is continues and $a_n$ is convergent but $\lim f(a_n) = \infty$

is my example false ?

if it's wrong, please give a proof or hint !
Consider the step function $f(x)=\lfloor{x}\rfloor$.$D=[-10,10]$. Consider the point $x=2$. Obviously, $f$ is not continuous. consider the sequence $x_n=2-\frac{1}{n}$, $f(x_n)=1$.
There are (at least) two equivalent definitions for continuity:


  A function $f$ is continuous at $x_0$ if for all $\varepsilon&gt;0$ there exists $\delta &gt;0$ such that for all $x\in (x_0-\delta,x_0+\delta)$, $|f(x)-f(x_0)|&lt;\varepsilon$
  
  A function $f$ is continuous at $x_0$ if for every sequence $x_n$ such that $x_n\to x_0$, $f(x_n)\to f(x_0)$


Your example is correct in the sense that it is a proof for the non-continuity of $f(x)=\frac{1}{x}$ at $x = 0$, assuming you define
$$
f(x) = \begin{cases}\frac{1}{x} &amp; x\neq 0 \\
L &amp; x = 0\end{cases}
$$
where $L&lt;\infty$, for else if your domain is $(0,1]$, then $\frac{1}{x}$ is continuous everywhere.