First of all, I am sorry for asking this question.
We know that $R$ is uncountable. And also the set of all transcendental numbers is uncountable. How can I construct a function $f(x)$ on $R$ which is continuos only at transcendental numbers? Is it possible?
Thanks in advance.
You have had some strong hints. Here's an even stronger one. Start with Thomae's function:
f(x) =
\begin{cases} \frac{1}{q}, & \text{if $x \in \mathbb{Q}$ and $x = \frac{p}{q} \land p \in \mathbb{Z} \land q \in \mathbb{N} \land p,q$ coprime} \\ 0, & \text{if $x \notin \mathbb{Q}$} \end{cases}
You need to understand why this works first. The idea is for $\epsilon > 0$ there are only finitely many values of $q$ such that $\frac{1}{q} \geq \epsilon$.
Now you need to add a case for the algebraic numbers.
f(x) =
\begin{cases} \frac{1}{q}, & \text{if $x \in \mathbb{Q}$ and $x = \frac{p}{q} \land p \in \mathbb{Z} \land q \in \mathbb{N} \land p,q$ coprime} \\ ?, & \text{if $x \notin \mathbb{Q} \land x \in \mathbb{A}$} \\ 0, & \text{if $x \notin \mathbb{A}$} \end{cases}
So, you need a suitable value for that ?, what value will work for algebraic numbers? You can use an idea similar the rationals. First, remember what an algebraic number is: it is the root of a non-zero polynomial with rational coefficients. Let $n$ be the lowest degree of any such polynomial. Can you see how to use $n$ similarly to how $q$ is used for the rational case?