I've recently come across a puzzle. There is an urn with N balls, numbered from 1 to N. I pick n < N balls without a replacement. What is the expectation of the largest number in my pick?

My first idea was to simulate the process but I remembered that it could perhaps be elegantly solved with Infer.NET. Is Infer.NET the right tool for the job? I am wondering about this Max operation which can pose problems for the sampler.

I saw somebody posting analytic solution to the problem that I didn't study yet. I want to think about it first before looking at a solution and verifying with a Infer.NET program.

Are there any Infer.NET examples where an expectation of a random variable is computed?