Distribution of a random real with i.i.d. Bernoulli(p) binary digits?

In answer to your questions:

  • $E[X] = \sum_i 2^{-i} E[X_i]= \sum_i 2^{-i} p = p$
  • $\text{Var}[X] = \sum_i \left(2^{-i}\right)^2 \text{Var}[X_i] = \sum_i 4^{-i}p(1-p) = \frac13p(1-p)$

For the cumulative distribution function, you can calculate (or arbitrarily well approximate) cumulative probabilities using:

  • $\Pr\left(X \le \frac{x}2\right) = (1-p)\Pr\left(X \le x\right)$ for $0 \le x \le 1$
  • in particular $\Pr\left(X \le 2^{-n}\right) = (1-p)^n$ for non-negative integer $n$
  • $\Pr\left(X \le \frac12+\frac{x}2\right) = (1-p)+p\Pr\left(X \le x\right)$ for $0 \le x \le 1$
  • in particular $\Pr\left(X \le 1-2^{-n}\right) = 1-p^n$ for non-negative integer $n$

Those create the fractal patterns in your graphs, and prevent the cumulative distribution function from being differentiable at any dyadic rational $x=\frac{m}{2^n}$ when $p \not \in \{0,\frac12,1\}$, as one of the left- and right-derivatives would approach zero and the other approach infinity, so these are singular distributions.

They also allow the calculation or approximation of individual values. For example

  • $\frac23 = 0.101010101\ldots_2$ and $\Pr\left(X \le \frac23 \right)= \dfrac{1-p}{1-p+p^2}$

  • $\frac1e = 0.010111100\ldots_2$ and $\Pr\left(X \le \frac1e \right)$ is slightly more than $1-p-p^2+p^3-p^5+2p^6-p^7$