3. St. Petersburg paradox

A casino offers a game of chance for a single player in which a fair coin is tossed untill the first time tails appears. If this happens at the \(k\)-th toss, the player wins \(2^k\) dollars. (So, if the firs toss is tail, the player wins \(2\) dollars, if the first toss if head, the second is tail, the player wins \(4\) dollars, but if the first \(9\) tosses are heads, and the \(10\)-th is tail, the player wins \(2^{10}=1024\) dollars (see Wikipedia). Simulate \(m\) games (that is we play till the \(m\)-th tail). What is the average payout if \(m=100\), \(m=10000\) and if \(m=1000000\)?

Write your code in a file called petersburg.py. The output of the program is the three average numbers with three digits rounded to three decimal places (after the decimal pont). The numbers are separated by spaces.

The aim of this task is to experience a random variable with infinite expected value. What would be a fair price to pay the casino for entering this game? (You do not have to answer this question.)