The 100 sided die problem has been asked before:
You are given a 100-sided die. After you roll once, you can choose to either get paid the dollar amount of that roll OR pay one dollar for one more roll. What is the expected value of the game? There is no limit on number of rolls.
The solution amounts to solving the equation, where the floor function is necessary because of the discrete die:
(1)$E=\dfrac {\lfloor E-1\rfloor }{100}\cdot \left( E-1\right) + \left( 1-\dfrac {\lfloor E-1\rfloor }{100}\right)\cdot\dfrac {\lfloor E\rfloor +100}{2} $
eg. Say the expected value is 87.5, you would roll again if you got x≤86 as your expected value is 86.5 after one roll (E-1), so with probability 86/100 your expected value would be E-1, if you got 87 or above, then obviously your expected value is $\dfrac {(100+87)}{2}$
The solution is $\dfrac {1223}{14}$
Now how do you solve that equation, without a numerical approach ?
I know that setting $\lfloor E\rfloor $= B and then writing the equation in terms of E, finding the roots ie when E is maximised, somehow works.
ie. $E = \dfrac {(B^2 + B - 10102)}{(2 (B - 101)} $
Then find the B that maximises this equation, which is $B = 101 - 10\sqrt {2}$, then try the nearest integer values, $\lceil B\rceil $, $\lfloor B\rfloor $ and see which one maximises the equation.
Does anybody know why that works and is that the best way to solve the equation, as this is an interview question after all?
$E=-\lfloor E\rfloor ^{2}+L\left[ E\right] +196.5$, then , setting $\lfloor E\rfloor$ = B , and finding the maximum, does not work? while using inequalities as dan_fulea does in his answer finds the correct answer, of E = 14.5
– JimSi Jun 02 '18 at 08:31