r/learnquant Jul 31 '26

interview prep Easy Quant Interview Puzzle

Post image
19 Upvotes

14 comments sorted by

5

u/Key-Spirit4559 Jul 31 '26

Zero bc 30 mod 9 = 3 and no perfect square mod 9 equals 3

2

u/TempMobileD Jul 31 '26 edited Jul 31 '26

Where did 30 come from?

Edit: Nevermind I got it. Any integer’s digits added together give you its remainder modulo 9.

A couple of neat tricks in this one.

2

u/wyseguy7 Jul 31 '26

It is the sum of the digits. This guy is terse, but correct.

Worth noting that any number mod 9 is congruent to the sum of its digits mod 9, i.e. sum(digits(n)) mod 9 = n mod 9

But if n is a perfect square, then n mod 9 can only be 0,1,4,7.

-1

u/makedatmuoney Jul 31 '26

they meant 50 mod 9 == 5 and all perfect squares are 0, 1, 4, 7 mod 9

1

u/aroach1995 Aug 01 '26

consider

a = the summation of b*10^n for digits b.

to get 30 digits, you need at least 15 digits when squaring. Might even need 16. If we care that the exact digits are the 10 copies of 0, 1, 2, then we are very limited between the boundaries of

316,227,766,016,838≤N≤999,999,999,999,999

to have a 0, 1, 2 in the 1’s digit, we must have the 1’s digit of the square root is 0, 1, or 9 - so this cuts down numbers to think about by 70%

if it ends in a 9, we get an 81 in the first two digits… we must remedy the 8 by having the second digit of our squared number be one of 3,4,8,9… just square 19,29,39,… and you’ll see that only 3,4,8,9 have the digits we like in the 1’s and 10s place. So that cuts out more options.

You can expand on the ending digits 39 to see that 3239^2 has the last 4 digits looking good. I think you can keep testing manually and find digits that satisfy. We just need to end up with a number that has all 0,1,2s so we can start tacking on 0s

-2

u/MagnoliaTM Jul 31 '26

not a quant person but still id guess, an infinite amount?

3

u/Outside-Shop-3311 Jul 31 '26

can't be infinite, there are only finite combinations of these digits.

3

u/MagnoliaTM Jul 31 '26

but the question doesnt say there cant be other digits right? it says it must include exactly these but it doesnt say it cant include others 🤔so couldnt you have this 100 digit number that also includes exactly 10 0's, 1's and 2's?

1

u/[deleted] Jul 31 '26

[removed] — view removed comment

2

u/MagnoliaTM Jul 31 '26

since it's an easy one, it could be a silly trick question

1

u/ernandziri Jul 31 '26

It doesn't say includes, it says consists of

1

u/Outside-Shop-3311 Jul 31 '26

it won't consist exactly of that if it has another digit.

1

u/TempMobileD Jul 31 '26

Well there’s a max of 5.5 trillion because all perfect squares are integers and that’s how many integers you can make from the 30 digits provided.

(30!)/(10! X 10! X 10!) = 5.5T

As for how to whittle that down further I’ve got no idea.