not much to do except define at described. There are several functions which work with this kind of condition:
Thomae's function, which is 1/q when x=p/q (rational), and 0 when x is irrational
Dirichlet function is just as you describe
A function whose domain is all reals, and which maps all rational numbers to 1 and all irrational
numbers to 0.
1 answer