Thomae's function
Thomae's function is a real-valued function of a real variable that can be defined as: f ( x ) = { 1 q if x = p q ( x is rational), with p ∈ Z and q ∈ N coprime 0 if x is irrational. {\displaystyle f(x)={\begin{cases}{\frac {1}{q}}&{\text{if }}x={\tfrac {p}{q}}\quad (x{\text{ is rational), with }}p\in \mathbb {Z} {\text{ and }}q\in \mathbb {N} {\text{ coprime}}\\0&{\text{if }}x{\text{ is irrational.}}\end{cases}}} 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), the Riemann function, or the Stars over Babylon (John Horton Conway's name).