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