Chapter 1: Problem 27
The following game is played. The player randomly draws from the set of integers \(\\{1,2, \ldots, 20\\} .\) Let \(x\) denote the number drawn. Next the player draws at random from the set \(\\{x, \ldots, 25\\}\). If on this second draw, he draws a number greater than 21 he wins; otherwise, he loses. (a) Determine the sum that gives the probability that the player wins. (b) Write and run a line of \(\mathrm{R}\) code that computes the probability that the player wins. (c) Write an \(\mathrm{R}\) function that simulates the game and returns whether or not the player wins. (d) Do 10,000 simulations of your program in Part (c). Obtain the estimate and confidence interval, (1.4.7), for the probability that the player wins. Does your interval trap the true probability?