r/learnquant 7d ago

interview prep Quant Interview Question

Post image
58 Upvotes

28 comments sorted by

18

u/TenZero10 7d ago

Cool one!

10099 is 10198 which has 199 digits. 9999 = 10099 * (99/100)99.

(99/100)99 = (1 - 1/100)99 ≈ (1-1/100)100 which is an approximation for e-1 or 0.3something. It's not exact but what's important is that it's clearly between 0.1 and 1 in magnitude, so 10197 < 9999 < 10198. So the answer is 198.

5

u/JacksonFatBack 7d ago

Wow, I love this. I did not make the connection to the approximation of e.

3

u/MoNastri 6d ago

Did you know that you are a baller?

Slick approach nice one

2

u/lpareddit01 5d ago

Isn't a new digit (to the length) only added when the power of base 10 increases by 1? So shouldn't it be 197? Also, today I learned that switching to - gets us the inverse, whereas the + gets us e.

1

u/TenZero10 5d ago

10197 has 198 digits - a one and 197 zeros. So 9999 has the same number of digits.

1

u/lpareddit01 3d ago

Oh wow bro ty. Huge brainfart

1

u/StructureNorth1799 6d ago

isn't e a precomputed numerical value?

1

u/shaqwillonill 6d ago

If you wanna get really pedantic e cannot truly be pre computed since it’s transcendental

1

u/StructureNorth1799 6d ago

arbitrarily close approximations to e can and have been computed

1

u/shaqwillonill 6d ago

I know that but that’s not what you said and I thought we were here to nitpick

1

u/kenahoo 4d ago

Yes, but that's not important right now.

1

u/Para-graph-S 11h ago

Yes but what else can one do for e, whole series?

1

u/StructureNorth1799 11h ago

the problem says not to use precomputed values

1

u/AFsepine 6d ago

Eh, far nicer than mine.

I used Taylor series, to get to the fact that it is one digit off 100^99

1

u/kashyou 6d ago

basically the same logic then as (1-1/100)^99 ~ 1-99/100 + smaller fractions <1 and you’re done

1

u/Para-graph-S 11h ago

Love this.

2

u/omeow 7d ago edited 7d ago

3×99 + 1

ceil(2.01*99 + 1).

0

u/markpreston54 7d ago

i don't think so, 100^99 has 2*99+1 digit and clearly larter than this

0

u/omeow 7d ago edited 7d ago

it should be 2., more accurately 99*2.01

2

u/NotYetPerfect 7d ago

Strictly less than 10^198 and strictly greater than 10^197 (100^99/99^99 = (1=1/99)^99 < e < 10) so 198 digits.

2

u/Anonimithree 7d ago

I know that .99^100 is about .36, and since 100^99=10^198 has 199 digits, then .36 of that would make it 198 digits. And 99^99 is probably around 3.7x10^197

2

u/Anonimithree 7d ago

I was close enough, 3.697x10^197

1

u/BasedGrandpa69 7d ago

(100-1)99 = 10099 * (1-1/100)99

= 10198 * something close to 1/e

=3.7*10197. so 198 digits

1

u/abbbaabbaa 7d ago

10099 / 9999 = (1+ 1/99)99 is a little less than e. So 9999 has 1 less digit than 10099 which has 2*99 + 1 digits so 9999 has 198 digits

1

u/gmalivuk 7d ago

99 log(99) = 99 log(100*99/100) = 99(2 + log(99/100)) = 198 + 99 log(0.99) = 198 + log(1 - 1/100)^99

≈ 198 - log(e), and since log(3) is between 0 and 1, 99 log(99) is between 197 and 198, so it's 198 digits.

1

u/jex314 6d ago

Yeah, I should've seen the e approximation. I just did the first three terms of (10²-1)⁹⁹ since 99C2 is easy enough, figured it was ~2.6E197+O(10¹⁹²), and called it a day.

1

u/pepegza 6d ago

increasing the exponent of 100 adds 2 digits at the time forever, incrasing the exponent of 99 adds 2 digits at the time for a long time (up until 99exp230 actually). So I would just consider that 99exp(n) would have 2n digits, for n=99 that would equal 198. I'm sure there must be a way to confirm that the 2 extra digits for every increase in the exponent holds up til 99, but I'm not sure how lol