A Long Chess Match

Two friends $A$ and $B$ are great fans of Chess. They both enjoy playing the game, but after each game the player who lost the game would like to continue (to get back at the other player) and the player who won would prefer to stop (to finish on a high).
So they come up with a plan. After every game, they would toss a (biased) coin with probability $p$ of Heads (and hence probability $1-p$ of Tails). If they get Tails, they will continue with the next game. Otherwise they end the match. Also, after every game the players make a note of who is leading in the match.
Let $p_A$ denote the probability of $A$ winning a game and $p_B$ the probability of $B$ winning a game. Accordingly $1-p_A-p_B$ is the probability that a game ends in a draw. Let $\mathbb{E}_A(p_A,p_B,p)$ denote the expected number of times $A$ was leading in the match.

For example, $\mathbb{E}_A(0.25,0.25,0.5)\approx 0.585786$ and $\mathbb{E}_A(0.47,0.48,0.001)\approx 377.471736$, both rounded to six places after the decimal point.
Let $\displaystyle H(n)=\sum_{k=3}^n \mathbb{E}_A\left(\frac 1 {\sqrt{k+3}},\frac 1 {\sqrt{k+3}}+\frac 1 {k^2},\frac 1 {k^3}\right)$
For example $H(3) \approx 6.8345$, rounded to 4 digits after the decimal point.
Find $H(50)$, rounded to 4 digits after the decimal point.

To solve this problem, we can use dynamic programming and compute the expected number of times A was leading up to a certain point in the match.

Here’s a Python code snippet that implements the calculation of the expected number of times A was leading using dynamic programming:

,,,,,,,,,,,,,

def calculate_expected_leading(pA, pB, p):
dp = [0] * (len(pA) + 1)
dp[0] = 0
for i in range(1, len(dp)):
dp[i] = dp[i-1] + pA[i-1]
for j in range(1, i):
dp[i] += p * dp[i-j] * pB[j-1]
return dp

def H(n):
result = 0
for k in range(3, n + 1):
pA = [1 / (k + 3)**0.5]
pB = [1 / (k + 3)**0.5 + 1 / k**2]
p = 1 / k**3
expected_leading = calculate_expected_leading(pA, pB, p)
result += expected_leading[-1]
return result

n = 50
result = H(n)
print(round(result, 4))
,,,,,,,,,,,,

Running this code will compute and print the value of $H(50)$, rounded to 4 digits after the decimal point.

More Answers:
Incomplete Words
Incomplete Words II
Largest Prime

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts