(2) Suppose we alter the definition of g so that 2^q is replaced by w(q), where w:Z+ --> Z+ is some increasing function. Then the following are left to the reader. (See [Nymann's paper] for (a) and other related results.) (a) If w(q) = q^2, then g is nowhere differentiable. (Use (2).) (b) If w(q) = q^3, then g is differentiable on a dense, uncountable set of irrationals, but nowhere twice differentiable. (c) No matter how rapidly w increases, the set A_0 of points of nondifferentiability is residual.
As a consequence of (c), no function vanishing at the irrationals and discontinuous at the rationals can be differentiable at the irrationals. In fact, a little more argument shows that no function can be discontinuous at every rational but differentiable at every irrational. (This last has been known, by another method of proof, for some time, e.g. [Boas' "Primer of Real Functions"], [Fort's paper].) The following theorem implies (c) and the above statements, and provides a nice application of the Diophantine approximation point of view. (A slightly weaker version appears in [Heuer's 1966 paper] and is considered from a more general viewpoint in [Beesley, Morse, and Pfaff's 1972 paper].)