## $N$ disks are placed in a row, indexed $1$ to $N$ from left to right.

Each disk has a black side and white side. Initially all disks show their white side.

At each turn, two, not necessarily distinct, integers $A$ and $B$ between $1$ and $N$ (inclusive) are chosen uniformly at random.

All disks with an index from $A$ to $B$ (inclusive) are flipped.

The following example shows the case $N = 8$. At the first turn $A = 5$ and $B = 2$, and at the second turn $A = 4$ and $B = 6$.

Let $E(N, M)$ be the expected number of disks that show their white side after $M$ turns.

We can verify that $E(3, 1) = 10/9$, $E(3, 2) = 5/3$, $E(10, 4) \approx 5.157$ and $E(100, 10) \approx 51.893$.

Find $E(10^{10}, 4000)$.

Give your answer rounded to $2$ decimal places behind the decimal point.

### It’s a very tricky problem and it doesn’t have an easy solution. The problem isn’t straightforward. For complexity reduction, it is approached with a bit of cleverness.

To understand the complexity of it, let’s use the concept of ‘Expectation’ in Probability. The expected number of white disks can be thought of as the sum of the probabilities of each disk staying white after the sequence of operations.

Due to symmetry, each disk has the same expectation to be white. So, for N disks, the starting point is `E(N,M) = N * E(1,M)`, and the task becomes to determine `E(1,M)`, which is the expected probability that one disk stays white after M turns.

At each turn, a disk has probability `p = 2/N` to be flipped (either it is `A or B`). If it is chosen, it will change its color, and if not, its color will remain the same. After the turn, the color of the disk is independent of its color before the flip. So we get:

“`

E(1, M) = p * E(1, M – 1) + (1 – p) * E(1, M – 1)

“`

This simplifies to

“`

E(1,M) = E(1,M – 1)

“`

So, `E(1, M) = E(1, 0) = 1` for any M.

Therefore:

“`

E(N,M) = N * E(1,M) = N

“`

So, `E(10^10,4000) = 10^10`. Round to 2 decimal places, the answer is `10000000000.00`.

##### More Answers:

$n$-sequencesNecklace of Circles

Sum of Squares of Unitary Divisors