Consider the polynomial,
is you multiply it out you get some negative terms and some positive terms. So we can write (and now has only positive terms).
Example: Say then and .
Now define to be at rational points and at irrational points.
Example: As above define to be at the rational points and at the irrational points.
Then it is continous precisely when so so so . This mean it is continous at exactly these points.
Note: It is not really necessary to do what I did there are many ways to construct such functions but I did it because it looks more pleasing.