def numberrepeats(N, t, iters):
    rand = np.random.randint(0, N, size=(t, iters))
return t - np.array([len(set(r)) for r in rand])
iters = 1000
ydata = np.empty(500 - 10)
for N in range(10, 500):
    sampledunk = np.count_nonzero(numberrepeats(N, t, iters) == unk)
ydata[N - 10] = sampledunk / iters
print('MLE is', np.argmax(ydata))
xdata = list(range(10, 500))
print(len(xdata), len(ydata))
plt.plot(xdata, ydata)
plt.show()
Plotting confidence intervals for Maximum Likelihood Estimate