Q: What is the probability that the ratio of two random reals starts with a 1? What about 9?

S: What is the distribution of y/x for (x,y) chosen with uniform distribution from the unit square?

First you want y/x in one of the intervals ... [0.01,0.02), [0.1,0.2), [1,2), [10/20), ... . This corresponds to (x,y) lying in one of several triangles with height 1 and bases on either the right or top edges of the square. The bases along the right edge have lengths 0.1 (for 0.1 <= y/x < 0.2), 0.01, 0.001, ... ; the sum of this series is 1/9. The bases along the top edge have lengths 0.5 (for 0.5 < x/y <= 1), 0.05, 0.005, ... ; the sum of this series is 5/9. So you have a total base length of 6/9 = 2/3, height 1, so the area is 1/3. The total area of the square is 1/3, so the probability that y/x starts with a 1 is 1/3 = 0.333333.

In the second case you have the same lengths (but in different places) on the right edge, total 1/9. But on the top edge, 9 <= y/x < 10 gives you 1/10 < x/y <= 1/9 gives you a base of length 1/9 - 1/10 = 1/90, and the series proceeds 1/900, 1/9000, ... ; the sum is 1/81. Total base length then is 9/81 + 1/81 = 10/81, height 1, total area (and hence probability of a leading 9) is 5/81 = 0.061728.