from random import randint
N = 10**4
n = 3
for m in range(n, 10):
e = 0
for _ in range(N):
xs = [None] * n
cnt = 0
while any(x is None for x in xs):
r = randint(1, m)
if any(x == r for x in xs):
for i in range(n):
if xs[i] == r:
xs[i] = None
else:
for i in range(n):
if xs[i] is None:
xs[i] = r
break
cnt += 1
e += cnt
e /= N
# f = 2 * m / (m - 1)
print((m, e))
To embed this program on your website, copy the following code and paste it into your website's HTML: