Probability of $ \sum_{n=1}^\infty \frac{x_n}{2^n} \leq p$ for Bernoulli sequence Probability of $ \sum_{n=1}^\infty \frac{x_n}{2^n} \leq p$  for a  Bernoulli(1/2) sequence $(x_n)$ and $p \in [0,1]$. I know that the answer should be just $p$ but how can you prove it?
Say for $p= 1/2$ I can look at it as 1-( Probability of being greater than 1/2) which is 1/2 since if our first term in the sequence is 1 then we're done. But how one shows for general $p$?

Write $p$ in base $2$.
$$\sum_{i = 1}^{\infty} \frac{p_i}{2^i}$$
We don't know these coefficients explicitly but we won't need to in the end. Then you have to look at what are the possible values for the $x_i$.
To get something smaller than $p$, you need to have $x_i = p_i$ up to a certain point where $p_k = 1$ and $x_k = 0$. This happens with probability $\frac{1}{2^k}$. Then, sum over all possible values of $k$ such that $p_k = 1$ (these events are indeed disjoint), which yield exactly $p$.
EDIT : this previous version of the answer did not address the right problem since I thought $p$ was the parameter of the Bernoulli law :
---I don't think the result is $p$. Assume for example $p = \frac{1}{2^n}$, denote $q = 1-p$, to get something lower than $p$ you have to get a zero in your $n$ first terms. Which happens with probability $q^n = \frac{(2^n-1)^n}{2^{n^2}}$ (which is different than $p$ for $n \ge 2$).---
