All problems
Ehrenfest Return Time
Problem
Expected return time to state 0 of the Ehrenfest chain with d balls, which equals the reciprocal of its stationary probability 2^(-d):
E[T] = 2^d.
Return 0 for negative d.
Hint
For a finite irreducible chain, the mean return time to a state is 1 over its stationary probability.
Test cases
case 1
in: [0]
expected: 1
case 2
in: [1]
expected: 2
case 3
in: [4]
expected: 16
case 4
in: [10]
expected: 1024
Starter codePython
def ehrenfest_return_time(d):
# Your code here
pass4 test cases · run your code against them in the editor