''' When is probability = 0.5 that in an image with N pixels, c point-like objects will not overlap (occupy the same pixel)? ''' from numpy import around,sqrt N = int(input("N pixels = ")) ratio = 1. c = 0 while(c < N): # c is the number of people/obj. c += 1 ratio = ratio *(N-c+1)/N p = 1 - ratio print("i",c,"P(none), P(some)", around(ratio,6),around(p,6)) if (p < 0.5): confusion = c+1 if (ratio < 1e-4): break print("confusion limit =", confusion, " sqrt(N)=",around(sqrt(N),2), " limit/sqrt(N) = ", around(confusion/sqrt(N),4))