practice problems pending
Q. How many non-negative integers can be written in the form:
a7.3^7 + a6.3^6 ... a0.3^0 where a_i belongs to {-1,0,1} for i = 0 to 7
Solution:
Let's say all a_i are 1
Then it's a GP: 3^7 + 3^6 .. 3^0
Sum = 1 * (3^8 - 1)/3-1 = (3^8 - 1)/2
So this is the max value of this expression.
Similarly the min value will be:
-(3^8 - 1)/2
So total possible integers in the min to max range =
(3^8 - 1)/2 - - (3^8 - 1)/2 + 1 = 3^8 - 1 + 1 = 3^8
Now, let's compute how many total ways are there to choose all possible combinations of a_i?
Each a_i can be chosen in 3 different ways so 3^8.
Aha!
So number of ways to choose all a_i is same as the min to max range.
So there is a one to one mapping.
So non negative integers are (3^8 - 1)/2 + 1
Q. a1 + a2 ... a2018 = 2018^2018
Then what is the remainder by 6 of a1^3 + a2^3 ... a2018^3
Solution:
For any integer n = n^3 mod 6
You can try all the cases when remainder of n by 6 is 0,1,2,3,4,5 you will get back same remainder for n^3.
So r = 2018^2018 mod 6 = 2^2018 mod 6
Remainder of 2^x mod 6 cycles between 2 and 4.
Answer: 4
Q. Let m be a given positive integer. Find a positive integer n such that m+n+1 is a perfect square and mn+1 is a perfect cube.
Solution:
There is a bit of a trial and error here.
So mn +1 = y^3
and m + n +1 = x^2
Let's say we start with the first eqn. Starting with the second becomes a bit complicated.
mn = y^3 - 1 = (y-1)(y^2 + y + 1)
Let m = y-1 => y = m + 1
n = y^2 + y + 1 = (m+1)^2 + m + 1 + 1 = m^2 + 3m + 3
Use this n in the second eqn:
m + m^2 + 3m + 3 + 1 = x^2 = (m + 2)^2 So x = m + 2
And it worked out cleanly with a bit of a luck.
Q. Is it possible to arrange the numbers from 1 through 9 in a sequence so that there are oddly many numbers between 1 and 2, between 2 and 3, …, and between 8 and 9?
No.
For that to happen positions of both 1,2 will be odd or both even.
Similarly for 2,3 3,4 and so on.
So all the numbers will be at odd positions or all will be at even.
Which is not possible.
Q. Three hockey pucks lying in a field. Named A,B,C. A player hits one puck in such a way that it passes between the other 2. He does it 25 times. Can he get back to the original position?
Solution:
No.
Why?
If ABC is a triangle like this:
A----B
\ /
\ /
C
Then ABC is clockwise reading.
And you pass C between A,B then ABC becomes the counterclockwise reading.
Each time you make a pass, orientation of the triangle flips from clockwise to counterclockwise or vice-versa.
So doing it odd number of times can't take it back to the original orientation.
Q2. Find the real solutions for:
a = [a/2] + [a/3] + [a/5] where [] is the floor function.
Solution:
a = a/2 -{a/2} + a/3 - {a/3} + a/5 - {a/5}
= 31a/30 - sigma(fractions)
=> a/30 = sigma(fractions)
RHS range is 0 <= RHS < 3
=> 0 <= a < 90
But if you notice the eqn:
a/30 = sigma(fractions)
LHS keeps increasing whereas RHS keeps alternating.
If we increment 'a' by 30 RHS will repeat.
So there will be a point after which RHS won't be able to catch up with LHS.
In fact, if we see the maximum value of RHS, it is 1/2 + 2/3 + 4/5 = 59/30 since 'a' is an integer.
So
0 <= a <= 59
And 'a' can't be negative since fractional parts are always positive.
Now, going back to our equation:
a/30 = {a/2} + {a/3} + {a/5}
If you look at {a/2}, its possible values are 0/2,1/2.
Basically if you divide a by 2, the possible remainders divided by 2.
Similarly for other 2 fractions.
If we denote r2 = remainder of a mod 2, similarly r3,r5, then:
a/30 = r2/2 + r3/3 + r5/5
a = 15r2 + 10r3 + 6r5
We can generate all possible solutions by combining r2 = 0,1 r3 = 0,1,2 r5 = 0,1,2,3,4
So total: 2*3*5 = 30 solutions.
Comments
Post a Comment