Skip to main content

Posts

Showing posts from 2017

Riddler express vitamin solution

I interpreted this as a question about the expectation of a discrete random variable. And I used octave to solve  this weeks riddler express . Suppose a new pill bottle has whole tablets. Each day you pull a tablet, if it's whole, divide it and return the unused half. What's the average number of days until you pull a half tablet? The outcomes are going to be 1 whole 1 half, 2 wholes 1 half, 3 wholes 1 half. And so on and on until all whole tablets are pulled. So call each outcome w i h: meaning pull i whole tablets then a half tablet. For a new bottle w 0 and h 0 are 100 and 0 respectively. Assume some present state of the bottle w,h. When a whole tablet is pulled, half is consumed and half is returned, so the state becomes w-1, h+1. Which means the bottle always has 100 tablets. So odds of pulling 1 whole tablet are 100/100, for 2 whole tablets we have 99/100, and so on, note we must take the product of pulling 1 and 2 because the odds of pulling 2 are conditio