# Screening interview, math questions

Tags: | Posted by Admin on 3/7/2012 12:44 PM | Comments (6)

For starters, don't just automatically act all "Game Over, man!" when you hit a dead end! Also, it helps to try to keep talking as you come up with an answer, because silence is very uncomfortable for both you and the interviewer!

There are companies that deal with numbers that will ask you some math questions. These are the kind of questions that you could use a computer or paper and pencil for.

1. According to a survey, 70 percent of the public likes coffee, and 80 percent likes tea. What are the upper and lower bounds of people who like both coffee and tea?
2. At 3:15, what is the angle between the minute and hour hands on an analog clock?
3. How many integers between 1 and 1, 000 contain a 3?
4. A book has N pages, numbered the usual way, from 1 to N. The total number of digits in the page numbers is 1, 095. How many pages does the book have?
5. How many 0s are at the end of 100 factorial? (That's 100 multiplied by every whole number smaller than itself, down to 1.)

If you like math, you'll love the above questions. If you don't...well, let's just say you're in for a world of hurt! on 3/7/2012 12:51 PM Here are answers:

50-70 percent. You could probably explain this by drawing pie charts and showing how in the upper bound, all people who like coffee like tea, and in the lower bounder, all the people who don't like coffee like tea.

15 minutes is the 3 on an analogue clock. Since it's 15 minutes (a quarter of an hour) after 3, the hours hand is a quarter of the way between three and four. Hence, the angle between the two is one quarter of the angle of an hour on the clock, so it's 1/12 * 1/4 = 1/48 of a circle. That's 7.5 degrees or pi/24 radian.
Don't feel like completely doing this for real right now, but I'd basically go with all the three thousands, then all the three hundreds not included in the three thousands, all the thirties not included in the last two, and all the threes not included in any of those. That's a terrible way of explaining it, but that's how I roll right now.

Well, 1-9 have one digit, 10-99 have two, 100-999 have three. So the total digits to go from 1 to 999 is 9 + 90*2 + 900*3 = 9 + 180 + 2700 = 2889. Pretty basic to tell that the pages need to fall in the 100-999 range, so we can say the number of pages over 99 is: 189 + 3x = 1095 -> 3x = 996 -> x = 332. Total number of pages is x + 99 = 332 + 99 = 431 pages.

To do another bad explanation (TV Tropes posts aren't really the right area for math lessons), but it will be the number of zeroes you can get onto the ends of factors of 100 factorial. That's every number ending in 0 (reasonably obvious) and every number ending in 5 (because I can multiply it by another number in the same interval of 10 to make a number ending in a 2, e.g. 15 * 12 = 180). Hence, it's two zeroes for every interval of ten, plus one additional one once we hit 100. There are ten intervals of ten between 1-100, so 2 * 10 + 1 = 21 zeroes. on 3/16/2012 9:42 AM The answers to 4 and 5 given by Admin are incorrect!

Problem 4:
The sum of digits:
0..9     is 45
00..99   is 10*45 + 10*45 = 900
000..999 is 100*45 + 100*45 + 100*45 = 13'500
We see that 2 digits are not enough to reach the goal 1095, but 3 digits suffice.

Let us name these digits as d1, d2 and d3 (from least to most significant)

d1 cannot be >= 2, otherwise the sum would be too high (900 + 900 > 1095). Therefore, d1 = 1.

Now the problem is simplified! We already know a huge part of the sum:
0 0 0 +
0 0 1 +
..... +
0 9 9 = 900

The remaining part looks like
1  0  0 +
1  0  1 +
....... +
1 d2 d3 = (1095 - 900) = 195

Let us break this sum into blocks:
Block0 with second digit = 0:
1  0  0 +
....... +
1  0  9 = 1*10 + 0*10 + 45 = 55

we need 195, but got 55, let's go on...

Block1 with second digit = 1:
1  1  0 +
....... +
1  1  9 = 1*10 + 1*10 + 45 = 65

Block0 + Block1 = 55 + 65 = 120
we've not reached 195 yet, let's go on...

Block2 with second digit = 2:
1  2  0 +
....... +
1  2  9 = 1*10 + 2*10 + 45 = 75

Block0 + Block1 + Block2 = 55 + 65 + 75 = 195
This is exactly what we need! The person who who chose the number 1095 had pity on us =)

So the answer is 129 pages on 3/16/2012 9:58 AM And here's how to solve Problem 5.

100! = 1*2*...*100

There's only one way a zero can appear in the result: some 2 is multiplied by some 5. If you decompose each of the 100 numbers into primes, then you can easily ignore all primes other than 2 and 5.

The number of 2's will be significantly higher than the number of 5's, so each 5 will easily get a corresponding 2.

We've just reduced the problem from counting the number of 0's in (100!) to counting the number of 5's in prime decomposition of numbers 1,2,..,100

Well, there are 100/5 = 20 numbers divisible by 5 and 100/25 = 4 numbers divisible by 25. This adds up to 20 + 4 = 24.

(Each number divisible by 25 contributes two 5's, but this number is counted twice, since it is divisible by 25 AND by 5)

So, the number of 0's in (100!) is 24. You can check that in Wolfram Alpha: http://www.wolframalpha.com/input/?i=100%21 on 3/17/2012 9:26 PM Q3: 100 3s at unit place (03 13 .. 93.. 103..193...)
100 3s at tenth place(30 31..39..130,131...)
100 3s at hundred place(300... 399)
So total of 300 3s

Q5: The answer is wrong at multiples of 5 i.e. 5,10,15.. 100 contribute 1 zeros and 25, 50, 75, and 100 contribute 1 more zero. So number of zeros in 100! will be 20+4 = 24 on 3/23/2012 8:01 PM Admin, I believe your answer to 4 is wrong. Specifically, you should get 189+3x = 1095 -> 3x = 906 -> x =302, so add 302+9+90 =401.

For number 3, we can use the inclusion-exclusion principal. If we fix a 3 in the hundreds digit (3**) then there are 10 options for each of the unfixed digits, or 10*10=100. Similarly for fixing a 3 in the tens digit (*3*) and the ones digit (**3). Summing we get 300, but we've overcounted, so we have to subtract the cases where two digits are 3s (33*, 3*3, *33), and for each one there are 10 options for the *, so we get -30. But again, we've overcounted, since they could all be 3 (333), so we add back 1. Combining this, we get 300 - 30 + 1 = 271. on 4/29/2012 10:14 PM 1. 50-70
2. 7.5 degrees
3. 271 (300-30+1, inclusion-exclusion)
4. 401
5. 100/5 +100/25 = 24 zeros   