TITLE: Is a function continuous if sequence definition holds only over 'almost all sequences'?
QUESTION [5 upvotes]: By the definition of a continuous function, $f:\mathbb{R}\to\mathbb{R}$ is continuous at $x$ if and only if for any sequence $x_n\to x$, it also holds that $f(x_n)\to f(x)$.
My question is as follows: Suppose $M\subseteq \mathbb{R}$ has measure zero. At every point $x\in\mathbb{R}$ and any convergent sequence $x_n\to x$ such that $x_n\in\mathbb{R}\setminus M$, it also holds that $f(x_n)\to f(x)$.
Is $f$ continuous? For what reason? Or is there a counter-example?

REPLY [2 votes]: Yes, such $f$ is continuous. First, recall that a set of measure zero has empty interior; the argument applies to any set $M$ with empty interior. 
Suppose, to the contrary, that there exists $a\in \mathbb{R}$ and a sequence $(x_n)\to a$ such that $f(x_n)$ does not converge to $f(a)$. For each $n$, pick a sequence $(t^{(n)}_k)$ contained in $\mathbb{R}\setminus M$ and converging to $x_n$; such a sequence exists because $M$ has empty interior. 
By the assumption, $f(t^{(n)}_k)\to f(x_n)$ as $k\to\infty$. Thus, there exists $k$ such that 
$$|t^{(n)}_k - x_n |<\frac1n\quad\text{ and } \quad 
 |f(t^{(n)}_k) - f(x_n)|<\frac1n$$  Denote this $t^{(n)}_k$ as $s_n $ for brevity. The sequence $(s_n)$ is contained in $\mathbb{R}\setminus M$, converges to $a$, but $f(s_n)\not\to f(a)$. Contradiction.