# Why $f(a_n)\to f(a)$ can imply continuity?

I would like to prove the following statement:

Consider a function $$f:\mathbb{R}\to\mathbb{R}$$. Prove that $$f$$ is continuous at $$a\in\mathbb{R}$$ if and only if for every sequence $$\lbrace a_n\rbrace$$ with $$\lim_{n\to\infty}a_n=a$$, we have $$\lim_{n\to\infty}f(a_n)=f(a)$$.

Here is my attempt: Suppose that $$f(x)$$ is continuous at $$a\in\mathbb{R}$$ and let $$\lbrace a_n\rbrace$$ be a sequence with $$\lim_{n\to\infty}a_n=a$$. Because $$f(x)$$ is continuous, $$\lim_{x\to a}f(x)=f(a)$$. Let $$\epsilon>0$$ be arbitrary. Then, there exists $$\delta>0$$ such that $$|x-a|<\delta$$ implies $$|f(x)-f(a)|<\epsilon$$. By the definition of convergence of a sequence, for every $$\epsilon>0$$, there exists a number $$N\in\mathbb{N}$$ such that $$|a_n-a|<\epsilon$$ for $$n>N$$. In particular, we can find $$N_0\in\mathbb{N}$$ such that $$n>N_0$$ implies $$0<|a_n-a|<\delta$$. Thus, $$|f(a_n)-f(a)|<\epsilon$$, which proves $$\implies$$.

I'm not sure how to approach the proof of the converse direction.

If $$f$$ is not continuous at $$a$$, then there is a number $$\varepsilon>0$$ such, for every $$\delta>0$$, there is a number $$x\in D_f$$ such that $$\lvert x-a\rvert<\delta$$ and $$\bigl\lvert f(x)-f(a)\bigr\rvert\geqslant\varepsilon$$. In particular, for each $$n\in\mathbb N$$, there a $$x_n\in D_f$$ such that $$\lvert x_n-a\rvert<\frac1n$$ and $$\bigl\lvert f(x_n)-f(a)\bigr\rvert\geqslant\varepsilon$$. So, $$\lim_{n\to\infty}x_n=a$$, but $$\lim_{n\to\infty}f(x_n)$$ either doesn't exist or, if it exists, it is not $$f(a)$$.