1.4 KiB
1.4 KiB
id | challengeType | title |
---|---|---|
5900f51a1000cf542c51002d | 5 | Problem 430: Range flips |
Description
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) ≈ 5.157 and E(100, 10) ≈ 51.893.
Find E(1010, 4000). Give your answer rounded to 2 decimal places behind the decimal point.
Instructions
Tests
tests:
- text: <code>euler430()</code> should return 5000624921.38.
testString: assert.strictEqual(euler430(), 5000624921.38, '<code>euler430()</code> should return 5000624921.38.');
Challenge Seed
function euler430() {
// Good luck!
return true;
}
euler430();
Solution
// solution required