You are given two positive ints: n and x.
You are going to choose x distinct integers, each between 1 and n, inclusive.
The choice will be made uniformly at random.
That is, each of the possible x-element subsets of the integers 1 to n is equally likely to be chosen.
Let S be the smallest integer among the x chosen ones.
Compute and return the expected value of 2^S.
In other words, determine the average value of 2 to the power of S, where the average is taken over all possible choices of the x distinct integers.
|