Re:Project Euler
by opk on Wednesday January 15, 2014 @10:59AM
(#7064039)
I get 1/4 as the optimal value for f. Given a 500/500 win lose, then final money = (1-f)^500*(1+2f)^500 = (-2f^2+f+1)^500. To find the maximum, the ^500 is irrelevant. Differentiating and finding a gradient of 0 gives: -4f+1=0 or f=1/4. Just by checking values, it seems I need to lose more than 555 times before I finish with less then 1 billion. I'm not sure how to calculate the probability of that, your formula doesn't seem to work. In any case, the problem seems to be purely mathematical rather than requiring code to be written.
[ Parent
| on HN ]
Re:Project Euler
by anonymoushn on Friday January 17, 2014 @12:16AM
(#7074427)
I have a different f that can win with only 433 heads.