Is there a function which has limit only given $a_1,a_2...a_n....$ infinite points. Find a function which has limit only in advanced marked points$(a_1,a_2,....a_n)$.
Here is my example.
$g(x) =
\begin{cases}
1,  & \text{if}~x\in\mathbb{Q} \\
0, & \text{if}~x\in\Bbb{R}\backslash \Bbb{Q}
\end{cases}$
$f(x) = (x-a_1)(x-a_2)...(x-a_n)g(x)$
But the problem I can't solve is that,is there a function which has limit only in advanced  given $a_1,a_2...a_n....$ infinite points.
 A: An equivalent way of asking this question is whether there exists a function which is continuous only on a given sequence.
Such a function may fail to exists, for example when your sequence is dense in $\mathbb{R}$ (e.g. $\mathbb{Q}$). Because the set of continuity points must be a $G_\delta$ subset (and therefore cannot be dense and countable).
On the other hand, if your sequence has no limit points, then one can easily construct such a function by dividing $\mathbb{R}$ into intervals, each containing a single element of the sequence, and then define the function on the each interval to be continuous only on that element (for example as you suggested in your question).
A: If I understand correctly your statement, then as stated this is not possible. You need some further hypothesis on the sequence $(a_n)$.
Otherwise take $a_n$ to be an enumeration of the rationals. If $f$ satisfies your condition then by assigning at each $a_n$ the limit value to $f(a_n)$ you obtain a function which is continuous on the rationals and discontinuous on irrationals. This is not possibly by
Baire's category theorem.
When the sequence has no accumulation
points there are several ways. You could e.g. use Weierstrass' Factorization Theorem
which states that given any sequence $(a_n)_{n\geq 1}$ of complex numbers, with $|a_n|\to \infty$, there is an
entire function $h(z)$ whose zeroes are exactly the elements of the sequence (see e.g. the link).
Then your argument taking your $g$ and $f(z)=h(z)g(z)$ still goes through.
But this may violate your requirement of 'not using series'?
A: Assume that there is an order preserving bijection between $a_n$ and N.
Define
$$ f(x)=\frac{1}{n}, \quad x \in[a_n, a_{n+1}).
$$
Then the function is discontinuous at every $a_n$ but has a right limit as $x \to a_n$.
If, however, you want double-sided limits then take a small $\delta$ and modify as
$f(x)=\frac{1}{n}$ for x $\in(a_n-\delta, a_{n}+\delta)$ and $f(x)=i$ inbeween (imaginary).
But in this case, you are going outside ot the real numbers.
From the perspective of the real numbers, the function is undefined between the intervals.
