Question: For many years, Meteorologists have spent long visits (5 days) at the Bigtown.
They have observed that, for three consecutive days, if there are EXACTLY two sunny days, the next day is a sunny day\*, while half of all the cloudy days are followed by another cloudy day. Assuming days are either cloudy or sunny, estimate how many days have been cloudy in their last ten visits. Visits are not necessarily following each other.

''half of all the cloudy days are followed by another cloudy day'' so $P(C\mid C)=50\%$

Is this possible? If not why not?

\*i.e.
SSC -> S

SCS -> S

CSS -> S

where -> means followed by

Answer: 
Note: edited since the question was clarified.

First, we cannot ever have two or more consecutive sunny days. If we do, then the next cloudy day (which may not be for some time, but will certainly be preceded by two sunny days) must be followed by two sunny days (since SSC->S, SCS->S), and the same for the next cloudy day after that, and so on. In particular, every future cloudy day is followed by a sunny day, contradicting the assumption that $50\%$ of cloudy days are followed by sunny ones.

Second, we cannot ever have two sunny days separated by a single cloudy day, since then the next day will be sunny, contradicting the previous point.

Now we know that in between every two sunny days there are at least two cloudy days. These cloudy days must include one which is followed by a sunny day, and at least one which is followed by another cloudy day. Since these two things are equally common, we must have exactly two cloudy days between every two sunny days.

Thus the unique sequence satisfying these properties is ...SCCSCCSCC... in which exactly $2/3$ are cloudy.
For when you get a mathematical answer, the following simulations suggest that the answer is around 2.22.

```
nclo=0
for (k in 1:100) {
ncloud=0
for (j in 1:10000) {
  chain=rep(0, 10)
  for (i in 1:10) {
    if (i==3) {
      if (chain[1]+chain[2]==2) {
        chain=rep(1, 10)
        break
      }
    }
    if (i>3) {
      if (chain[i-1]+chain[i-2]+chain[i-3]>=2) {
        chain[i]=1
      }
    }
    if (runif(1)>.5) {
      chain[i]=1
    }
  }
  ncloud=ncloud+(10-sum(chain))
}
nclo=nclo+ncloud/10000
}
nclo=nclo/100

```

```
> nclo
[1] 2.221082

```