# Python for a coin tossing puzzle

Player A has $$m$$ coins and player B has $$n$$ coins. Player A tosses all her coins and records the number of heads. Player B does the same. What is the probability that A tosses more heads than B? I wrote some code to solve this puzzle. I found a recurrence. I don't know whether a closed form exists. If you know, please contact me!

\begin{align} & P(0, n) = 0 \\[1em] & P(m, 0) = \dfrac{2^m - 1}{2^m} \\[1em] & P(m, n) = \dfrac{P(m, n - 1) + P(m - 1, n)}{2} \end{align} Download my Python code