Is there a bounded function discontinuous on a countable dense subset?

Is there a function that is continuous everywhere except on a countable dense subset, but is bounded?

Bounded in the sense that supremum of $f$ is a finite number.

-
It needs to be integrable, Riemann or Lebesgue. –  Rajesh D Aug 3 '14 at 15:55
OP: Which criterion do you know to determine some function is Riemann integrable? –  Did Aug 3 '14 at 16:22
@Did countable set of points of discontinuity –  Rajesh D Aug 3 '14 at 16:25
And this gives you no idea to solve the exercise? –  Did Aug 3 '14 at 16:36

The function $f(p/q)=1/q$ and zero at irrationals seems to fit the bill.

-
thanks @user72694 –  Rajesh D Aug 3 '14 at 15:52
Forgot to include another condition in the question : Is it Riemann integrable? if not, then atleast lebesgue integrable? –  Rajesh D Aug 3 '14 at 15:54
It's actually Riemann integrable believe it or not. –  user72694 Aug 3 '14 at 15:57

Yes. The typical example is K.J. Thomae's function $f$ from 1875 mentioned in another answer: Define $f(x)=0$ if $x$ is irrational. If $x$ is rational, write $x=p/q$ where $q>0$ and $p,q$ are relatively prime, and set $f(x)=1/q$. One easily checks that the function is bounded (having range contained in $[0,1]$), continuous at all irrationals, and discontinuous at all rationals.

More generally, given any real-valued function (with domain an interval), its discontinuities form an $F_\sigma$ set (a countable union of closed sets), and any $F_\sigma$ set can be obtained this way. This is a result of W.H. Young from 1903. The example above corresponds to taking as $F_\sigma$ set the set of rationals. Note that the rationals are countable union of singletons, and every singleton is closed.

-
Is it Riemann integrable? if not, then atleast lebesgue integrable? –  Rajesh D Aug 3 '14 at 15:55
Thomae's function? Yes: If a function is bounded and has only countably many discontinuities then it is Riemann integrable. You can even relax the latter requirement to "the set of discontinuities has measure zero", which all countable sets satisfy. –  Andres Caicedo Aug 3 '14 at 15:57