2018-09-30 23:01:58 +01:00
---
id: 5900f4771000cf542c50ff8a
title: 'Problem 267: Billionaire'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 301916
2021-01-13 03:31:00 +01:00
dashedName: problem-267-billionaire
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
You are given a unique investment opportunity.
2020-11-27 19:02:05 +01:00
2021-07-24 09:09:54 +02:00
Starting with £1 of capital, you can choose a fixed proportion, $f$, of your capital to bet on a fair coin toss repeatedly for 1000 tosses.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
Your return is double your bet for heads and you lose your bet for tails.
2021-07-24 09:09:54 +02:00
For example, if $f = \frac{1}{4}$, for the first toss you bet £0.25, and if heads comes up you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is tails, you have £1.125.
2018-09-30 23:01:58 +01:00
2021-07-24 09:09:54 +02:00
Choosing $f$ to maximize your chances of having at least £1,000,000,000 after 1,000 flips, what is the chance that you become a billionaire?
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
All computations are assumed to be exact (no rounding), but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2021-07-24 09:09:54 +02:00
`billionaire()` should return `0.999992836187` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-24 09:09:54 +02:00
assert.strictEqual(billionaire(), 0.999992836187);
2020-11-27 19:02:05 +01:00
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
2021-07-24 09:09:54 +02:00
function billionaire() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-24 09:09:54 +02:00
billionaire();
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```