Sadly the Friday quiz that I subscribe to is having a break for three weeks. I have subscribed to other maths problems and this one that caught my eye this week:
The Baseball Game
Ivy has created a game for her school’s math fair. She put three baseballs, numbered 1, 2, and 3, into a bag. Without looking, a player will randomly draw a baseball from the bag, record its number, and then put the baseball back into the bag. They will do this two more times and then calculate the sum of the three numbers recorded. If the sum is less than 8, the player will win a prize.
What is the probability that a player will win a prize when they play this game once?
This isn't too difficult to work out. I did it with a spreadsheet but you can reason it out I think.
Look away now if you want to work it out for yourself first.
I haven't yet had the official answer, but the answer that I and my partner have both found is 85.185%, that being 23 winning combinations out of 27 possible combinations.
The reason that this really caught my imagination is that instead of calculating the answer, I wanted to simulate the game - draw the three numbers over and over, and calculate the answer. I believe that the more iterations, the closer the result should come to our calculated answer. My friend Robin of 8-bit Show and Tell used a similar technique to find an approximation of pi.
So here's my program. I used the C64 (sixtyclone) because instead of a rnd() function, I wanted to use the SID's noise waveform. It uses a 23-bit LFSR, which you can read (8 bits of) to obtain a convincing random number. Again Robin has explained this.
Comments
Post a Comment