The Thomae function on the real line is at irrational and for a rational written in lowest terms with . It is continuous at every irrational point and discontinuous at every rational point.
To see continuity at an irrational , choose . In any bounded neighborhood there are only finitely many reduced rationals with denominator at most ; avoid them with a smaller neighborhood of . All remaining values are less than . At rational , irrational points approaching it have value zero instead of . Despite these dense discontinuities, the function is Riemann integrable on every closed finite interval, with integral zero.
New to topics? Read the docs here!