Posts

practice problems

Image
Q. An integer is assigned to each vertex of a cube. The value of an edge is defined to be the sum of the values of the two vertices it touches, and the value of a face is defined to be the sum of the values of the four edges surrounding it. The value of the cube is defined as the sum of the values of its six faces. Suppose the sum of the integers assigned to the vertices is 34 . What is the value of the cube? Solution: Each vertex is part of 3 edges. Each edge is part of 2 faces. So each vertex gets added 6 times. 34*6 = 204 = Answer Q. Suppose you are asked to fill up a 5×5 grid with any 25 natural numbers such that the sum of numbers in each row is even and each column is odd. Do there exist such a configuration? Solution: No. If each row sum is odd, then total grid sum = odd + odd + odd + odd + odd = 5 odds added = odd But by the same logic for columns it's even. So no. Q. Solution: Factorize: How? Try with (x^(2^3) - y^(2^3)) which is x^8 - y^8 = (x^4 - y^4) (x^4 + y^4) = (x^...

practice problems

 Q. Find the last digit of (((3^13) ^ 13) ^ 13...) Solution: Powers of 3 cycle with a period of 4 So 3^13 mod 10 = 3 And again it's the power 13 and so on. So mod 10 will always be 3. Answer: 3 Q. floor(x) = -(ceiling(-x)) True or False? True. You can try with 0, +ive, -ive integers. +ive, -ive fractional numbers. Q. The square of a number ending with 25 , must end with 625 . True or false? True Solution: (100x + 25) = 10000x + 5000x + 625 mod 1000 = 625 always Q. 2x = ceil(x) + floor(x.floor(x)) Find the number of non integer solutions for x. LHS is an integer. So x is either an integer or integer + .5 We need to find non-integer solutions so consider x = n +  0.5 2n + 1 = n + 1 + floor((n + 0.5).n) n = floor(n^2 + 0.5n) = n^2 + floor(0.5n) Case 1: If n is even integer, RHS > LHS except when n = 0 n = 0 => x = 0.5 Case 2: n is odd. n = n^2 + n/2 - 1/2 n^2 -n/2 - 1/2 = 0 2n^2 - n - 1 = 0 2n(n-1) -1(n-1) = 0 n = 1/2,1 n is an integer so n = 1 x = 1.5 So 2 solutions: ...

Why every integer is congruent to sum of its digits modulo 9

Let the number have 'k' digits. So the number is: d_k.10^k + d_(k-1).10^(k-1) ... d_0.10^0 Take mod 9. Any power of 10 mod 9 = 1 so the result is: d_k + d_(k-1) ... d_0 which is sum of its digits. So any 2 integers which have same digits will have same remainder upon division by 9.

practice problems pending

Q. Determine the smallest prime that does not divide any five-digit number whose digits are in a strictly increasing order. Solution: 2 doesn't work: 12346 3,5 don't work: 12345 7 doesn't work: 12348 (since 348-12 = 336 div by 7) 11 => abcde => a-b + c-d + e a-b <= -1 c-d <= -1 5<=e <= 9 Max sum = 7 Total sum can never be <= 0 because e + a + c > b + d always. Why? Because e > d c>b. So sum can never be 0 or multiple of 11. 11 is the answer. For finding the min value, also see: a + (c-b) + (e-d) 1     1           1 So min value is 3 Q. Suppose for some positive integers ( r ) and ( s ), the number ( 2^r ) is obtained by permuting the digits of the number ( 2^s ) in decimal expansion. Prove that ( r = s ). Solution: Since both the number have same number of digits('d') and same sum of digits, we use those properties. Sum of digits is same =>  2^r = 2^s mod 9 Why? Proof here. WLOG r >= s => 2^(r-s) =...

practice problems pending

Image
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^20...

Chinese remainder theorem

 How do you find 'x' s.t. x = 3 mod 11 x = 4 mod 7 x = 1 mod 5 First check that 5,7,11 are pairwise co-prime. Done. Then we write 'x' as sum of 3 numbers in a way that 2 of them disappear when taking mod by any of 5,7,11 So x = a.7.11 + b.5.11 + c.5.7 If I do x mod 5, I will get a.7.11 mod 5 and rest 2 numbers will disappear. Same for 7 and 11. Now I need to ensure that a.7.11 mod 5 = 1. For this we do trial and error and start with a = 1 a.77 mod 5 = a.2 mod 5 = 1 => a = 1,2 doesn't work. a = 3 works. b.55 mod 7 = 4 => b.6 mod 7 = 4 => b = 3 c.35 mod 11 = c.2 mod 11 = 3 => c = 1,2,3,4,5,6 don't work. c = 7 So x = 3.77 + 165 + 245 = 231 + 410 = 641 Test 641 mod 5 = 1 641 mod 7 = 4 641 mod 11 = 3 So it works. But there are multiple such solutions. They are of the form: 641 + lcm(5,7,11).k = 641 + 385k And smallest positive value would be 641 - 385 = 256

practice problems

 Q1. aabb is a 4 digit number and a square. find it. n = aabb = 1100a + 11b = 11(100a + b)  => 100a + b = 11k for 'n' to be a squre. a = 1 to 9 b = 0 to 9 a = 1, b = 0-9 => range = 100 to 109 , nothing here divisible by 11. a = 2,3... will give us these numbers divisible by 11: 209 308 407 506 605 704 803 902 When we divide them by 11, we should get a square. It happens only with 704 = 11*64 So the answer is 704*11 = 7744 Q2. Find all positive integers n less than 1999 such that n^2  is equal the cube of the sum of n's digits. Solution: n^2 = s^3 => s is also a square. Let s = m^2 => n^2 = m^6 => n = m^3 So iterate over all cubes < 1999 => 1 <= m <= 12 m = 1 => m^3 = 1 => n = 1 s = 1 n^2 = s^3 True m = 3 => m^3 = 27 = n => s = 9, s^3 = 729 = n^2 = 27^2 True No other number works Answer n = 1,27