With each step, we move either clockwise or counterclockwise each with probability $\frac{1}{2}$ independent of the previous steps. Starting at 6 o’clock, what is the probability that we visit all the hours from 1 o’clock to 11 o’clock before visiting 12 o’clock?
Solving this numerically I arrive at an approximation of $\approx 0.04$. My code is provided below.
import random
clock = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
N = 100000
success = 0
for _ in range(N):
index = 6
touches = []
while True:
U = random.uniform(0,1)
if U < 0.5:
index -= 1
else:
index += 1
if clock[index] == 1 and 1 not in touches:
touches.append(1)
elif clock[index] == 11 and 11 not in touches:
touches.append(11)
elif 1 in touches and 11 in touches:
success += 1
break
elif clock[index] == 12:
break
else:
pass
print(round(success/N,4))
However, I was unsure as to how to verify this output provided the study of random walks. I have that given a simple symmetric random walk, the probability of reaching some $\ b$ before $\ 0$ is defined as: $$\ P[W(a) \ hit \ 0 \ before \ b] = 1 - \frac{a}{b}$$ This, however, does not produce 0.04 when substituting $\ a, b$ in the argument. Any help in guiding the probabilistic set up is much appreciated.