Function that is discontinuous at rationals and continuous at irrationals
Point plot on the interval (0,1). The topmost point in the middle shows f(1/2) = 1/2
Thomae's function is a real-valued function of a real variable that can be defined as:[1]: 531
It is named after Carl Johannes Thomae, but has many other names: the popcorn function, the raindrop function, the countable cloud function, the modified Dirichlet function, the ruler function (not to be confused with the integer ruler function),[2] the Riemann function, or the Stars over Babylon (John Horton Conway's name).[3] Thomae mentioned it as an example for an integrable function with infinitely many discontinuities in an early textbook on Riemann's notion of integration.[4]
Since every rational number has a unique representation with coprime (also termed relatively prime) and , the function is well-defined. Note that is the only number in that is coprime to
It is a modification of the Dirichlet function, which is 1 at rational numbers and 0 elsewhere.
^Beanland, Kevin; Roberts, James W.; Stevenson, Craig (2009), "Modifications of Thomae's Function and Differentiability", The American Mathematical Monthly, 116 (6): 531–535, doi:10.4169/193009709x470425, JSTOR40391145