Hyperloglog, Probability, Hash Function, Cardinality Estimation, Dynamic Programming.
s N = 5 n = 1 << N u = ncr(n) for m in range(1, 10): # Get all combinations of k1, k2, ... km similar to previous out = [] hn(N, m, [], out) s1, s2 = 0, 0 # Compute the 1st summation in the above expectation formula for x in out: p = gn(x, 0, n, m, u, {})/m**n q = 2**(1.0 + sum(x)/m) s1 += p*q**2