Problem. Let $X_n=0$ or $1$ and set $Y_n=(X_n,X_{n+1})$. Set also $\displaystyle \sum_{k=1}^{n}\mathbb{I}_{\{X_k=1\}}$ be the number of times $X_k's$ become $1$, from $X_1$ till $X_n$ ($\mathbb{I}_{A}$ is the indicator of set $A$). Can this sum be described in terms of the $Y_n'$s?
I have started working with some easy strings of $0$'s and $1$'s but i can't seem to be making a pattern out of it!
Thanks a lot in advance!
Community wiki answer so the question an be marked as answered:
As Paul Sinclair wrote in a comment, there are $4$ possible values of $Y_n$; define $f(0,0)=0$, $f(0,1)=f(1,0)=1/2$, $f(1,1)=1$; then your sum can be expressed as $(X_1 + X_n) / 2 + \sum_{k=1}^{n-1} f(Y_k)$.