Coupon Collector’s Problem
The Coupon Collector’s Problem is about how many draws it is expected to take in order to collect all coupons by random draw. 1
Solution
The solution to the problem is , where is the number of coupons to collect and is the -th harmonic number: 1
In Haskell: 1
expected :: Int -> Float
expected n =
fromIntegral n * sum [ 1.0 / (fromIntegral k) | k <- [1..n] ]