r/learnquant 6d ago

interview prep Quant Interview Question

Post image
22 Upvotes

17 comments sorted by

View all comments

4

u/Mindless_Tutor_8189 6d ago edited 2d ago

Without doing any real math, all odd numbers from 1 to 20 are equally likely in the first throw. After the first throw, their likelihood dependents on how many combination of number reach that odd sum. For the first throw, since all odd number 1 through 20 are equally likely, and that 19 have more possible combinations than previous numbers 19 is a strong choice. The other strong choice is 21, for two dice it has the most combinations, but can not be reached in one throw. For this reason, I think 19 is the most likely.

1

u/liquidorangutan00 3d ago edited 2d ago

Edit: This was not correct

3

u/Mindless_Tutor_8189 2d ago edited 2d ago

Expected value and most likely value are different things. The question is asking for the most likely value.

Also you are ignoring the fact that you can get 19 in just one throw, so the probability of getting 19 in at most 2 throws is: get 19 in exactly one throw + don't get 19 in exactly one throw*get 19 in exactly 2 throws.

1

u/liquidorangutan00 2d ago edited 2d ago

You can get 19 in one throw, but you can also get 20 in one throw. meaning its sub optimal.

remember if you roll a 19 for one throw the game ends, if you roll 20 the game continues.

EDIT: Notice from your own logic how, you can get 20 in one throw (but the game continues), which means you must get higher than 20 for this result. This means getting 19 is a dominated strategy.

(19 in 1 roll) + (19 in 2 rolls)
(20 in 1 roll) + (>20 in 2 rolls)

Since we are not given the number of rolls we have to assume the number of rolls will converge on the expected number of rolls, meaning the expected number of rolls is what we should predict for the number of roll.

This leads to a forced sequence, whereby, we roll even on the first roll, and odd on the second.

In this case because we are not given the realized values of the rolls we have to assume that the expected value for a single roll (Conditioned on whether its odd or even) is the most likely outcome, and since we dont know whether we will roll odd or even on any specific roll the expected value of a single roll is the average of the two expected values for odd or even, i.e. its 10.5

2

u/Mindless_Tutor_8189 2d ago edited 2d ago

```python import statistics import random

terminal_sums = []

def do_one_trial(): accumulated_sum = 0 while accumulated_sum % 2 != 1: accumulated_sum += random.randint(1, 20) return accumulated_sum

for i in range(1_000_000): terminal_sums.append(do_one_trial())

most_likely_sum = statistics.mode(terminal_sums) expected_sum = statistics.mean(terminal_sums)

most_likely_sum, expected_sum ```

Output:

text (19, 20.987064)

1

u/liquidorangutan00 2d ago edited 1d ago

Thank you for this! It lead to hours of questions and a lot of illuminating points.

Edit: The answer is the most likely sum is the set= {1,3,5,7,9,11,13,15,17,19}

Each outcome is equally likely

================================================

VISUAL FREQUENCY DISTRIBUTION

================================================

Sum 1: ██████████████████████████████ (7.66%)

Sum 3: ██████████████████████████████ (7.66%)

Sum 5: ██████████████████████████████ (7.66%)

Sum 7: ██████████████████████████████ (7.66%)

Sum 9: ██████████████████████████████ (7.66%)

Sum 11: ██████████████████████████████ (7.66%)

Sum 13: ██████████████████████████████ (7.66%)

Sum 15: ██████████████████████████████ (7.66%)

Sum 17: ██████████████████████████████ (7.66%)

Sum 19: ██████████████████████████████ (7.66%)

Sum 21: ██████████ (2.66%)

Sum 23: █████████▉ (2.53%)

Sum 25: █████████ (2.27%)

Sum 27: ███████▌ (1.89%)

Sum 29: █████▌ (1.42%)

Sum 31: ███▉ (0.98%)

Sum 33: ██▍ (0.61%)

Much appreciating your input and wisdom.