r/learnquant • • 3d ago

interview prep Quant Interview Question

Post image
17 Upvotes

32 comments sorted by

3

u/LatexSalesman1 3d ago

1110

1

u/BrotherItsInTheDrum 2d ago

I got the same answer, but did you just do this immediately in your head? I had to do some work to get there, and I'm curious about your method.

1

u/lolcrunchy 3d ago

Wouldnt we need the probability distribution of the number of digits in the expansion, which is undefined?

1

u/A_BagerWhatsMore 3d ago

It’s a uniform distribution. Both uniform distribution and next digit in decimal expansion map nicely onto the same concept, length. So it’s 1/10 for each digit each time.

1

u/lolcrunchy 3d ago

There are 10 one-digit decimals. There are 100 two-digit decimals. You're saying the probability of picking a one-digit decimal is the same as the probability of picking a two-digit decimal?

1

u/A_BagerWhatsMore 3d ago

Well technically yes since we have a 0% chance to get a rational number, but I did misunderstand the question.

1

u/TheRonJonSilver 2d ago

there’s a 0% probability of picking a one-digit decimal. that’s why your intuition is off here.

1

u/dopyuu 3d ago

there is a 0% chance of choosing a rational number

1

u/AdvancedCarpenter888 3d ago

1002

1

u/CodingThunder 2d ago

Where is the additional 2 coming from? isn't it 1/((1/10)3), which should evaluate to 1000?

1

u/justhereforfighting 2d ago

That’s the starting position for the 3 number sequence. You expect to see it start by position 1000 so it would end at position 1002

1

u/CodingThunder 2d ago

hmm makes sense. thanks!

1

u/OutrageousPair2300 3d ago

444 makes up 1/1000th of all possible three-digit sequences. To see 1000 such sequences, we need at least 1002 digits -- the three-digit sequence starting at position 1, the one starting at position 2, ... all the way up to the three-digit sequence starting at position 1000 and continuing to 1001 and 1002.

2

u/ProfessorPhi 2d ago

Problem with this is that you don't account for a sequence of like 944 and then 411 which does produce the answer.

And you've done a pigeonhole principle approach, not an expectatio, which is invalid. If you were to take you're approach, it would be 999 triplets which is 2997 numbers, which is an overestimate due to the above point.

2

u/BrotherItsInTheDrum 2d ago

This is seemingly intuitive, but it's incorrect.

The reason is that it assumes having 444 at one position is independent of having 444 at any other position. But that's not the case. If 444 is at position 5, say, then the probability of 444 also being at position 6 is 1/10, not 1/1000.

1

u/Warm-Gear-2732 2d ago

should be 1110

1

u/BrotherItsInTheDrum 2d ago

Let the expected value be X.

90% chance: the first digit is not 4, and the expected value is now X+1.

9% chance: the first digit is 4 but the second is not. The expected value is now X+2

0.9% chance: the first 2 digits are 4 but the third is not. The expected value is now X+3.

0.1% chance: the first 3 digits are all 4, and the expected value is 3.

So we have X = (0.9)(X+1) + (0.09)(X+2) + (0.009)(X+3) + (0.001)(3)

Solving the equation, we get X = 1110. Scarily, I plugged the equation into Google, and Gemini both solved it and recreated the original question (in a slightly different form). Shit's getting real.

1

u/ProfessorPhi 2d ago

Oh this is clever, doing it via the expectation itself rather than on the probability sequences.

1

u/OneSushi 3d ago

1000?

1

u/Dr0110111001101111 2d ago

You cannot pick a real number on an interval of R uniformly at random.

2

u/BrotherItsInTheDrum 2d ago

Yes you can? As long as the interval is finite.

2

u/Dr0110111001101111 2d ago

An interval of R is an uncountably infinite set?

2

u/BrotherItsInTheDrum 2d ago

"Finite interval" meaning an interval of finite length, rather than one that goes off to infinity or negative infinity.

2

u/Dr0110111001101111 2d ago

ok... how do you pick such a number?

1

u/BrotherItsInTheDrum 2d ago

By "you can" I mean that the process is mathematically well-defined, so you can reason about it. There are a number of equivalent ways to express it. One is that you roll an infinite number of 10-sided dice, one per digit.

Of course in the actual physical world, I can't actually write one down.

1

u/OutrageousPair2300 1d ago

Roll a ten-sided die for each digit to the right of the decimal point.

That works to generate random numbers uniformly on [0,1] but won't work in the other direction (to the left of the decimal point) because digit sequences aren't allowed to continue to the left forever in the Reals.

2

u/pos_vibes_only 22h ago

Ok and when do you stop?

1

u/OutrageousPair2300 22h ago

You don't. Digit sequences are allowed to continue to the right forever, such as 0.333.... or 0.25000... and both are valid real numbers.

You can't do the same going to the left, since while ...00042 is a valid real number, ...555 is not.

1

u/kenny744 2d ago

:((( who asked you

1

u/OutrageousPair2300 1d ago

You can with a bounded interval, such as [0,1]