Not too long ago, with the aid of this question, I was able to deduce that for any natural number $b$, the binary representation of $\frac{1}{b}$ will have a cycle of repeating digits of length $\phi(b)$, where $\phi$ is Euler's Totient Function. The digits that repeat are the same sequence of digits as are found in the terminating $\frac{2^{\phi(b)}-1}{b}$.
For example, $\frac{1}{9}=0.\overline{000111}_{(2)}$. The cycle is of length $\phi(9)=6$, and the sequence of repeating digits are $\frac{2^{\phi(9)}-1}{9}=7=111_{(2)}$.
Hence, we can calculate that the "percentage" of digits that are ones in the binary expansion of $\frac{1}{b}$ as $$\frac{H\left(\frac{2^{\phi(b)}-1}{b}\right)}{\phi(b)}. \text{E,g; for }b=9:\ \frac{H(7)}{6}=\frac{3}{6}=50\%$$ where $H$ is the Hamming Weight.
How can we extend this to calculate the "percentage" (for lack of a better term) of digits that are ones in the binary expansion of any rational number $\frac{a}{b}$, and not just the reciprocals of the natural numbers?