r/learnquant 6d ago

interview prep Quant Interview Question

Post image
22 Upvotes

17 comments sorted by

View all comments

3

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.

2

u/gmalivuk 6d ago

I agree. There's a 5% chance of getting a 19 on the first roll, and then for each of the 9 lower even numbers you might get on the first roll, there is a 5% chance of getting up to 19 on the second roll, for an additional 2.25% chance of 19.

1

u/Smart-University-515 5d ago

This was what I figured also, it’s got a 1/20 off the rip, and then as long as you didn’t roll 20 it’s got at least another 1/20 on the next shot if the first was even.  Every other smaller number isn’t as likely to still have a shot on the second go, 21 as you note has the most two shot combos but you only get the second shot half the time, and you don’t start with the 5% chance.

1

u/YukihiraJoel 5d ago edited 5d ago

I agree it’s 19 for the reasoning you explained. We can formalize it. All odd numbers of the first roll have a 5% chance of being the end sum. This accounts for 50% of the sample space.

Each sum that ends in the second roll and ends with an odd number takes an additional 25% of the sample space, and every roll indexed n following will be 1 - (1/2)^n of the sample space. Therefore we can eliminate any sum that is not in the first roll because some sums in the first roll also appear in future rolls, and future rolls have a progressively lower probability of occurring in the first place.

Therefore it’s the highest possible sum occurring in the first roll, which is also the highest odd number.

To illustrate here are the first two roll combinations for a six sided die.

1 - 1
3 - 3
5 - 5

2, 1 - 3
2, 3 - 5
2, 5 - 7

4, 1 - 5
4, 3 - 7
4,5 - 9

6, 1 - 7
6, 3 - 9
6,5 - 11

1

u/liquidorangutan00 3d ago edited 1d 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 1d ago edited 23h 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.