A pen costs Rs 11 and a notebook costs Rs 13. Find the number of ways in which a person can spend exactly Rs 1000 - Solution 1
Prerequisites:
Divisibility by 11.
Solution 1:
11p + 13n = 1000
Now we can do:
13n = 1000 - 11p
n = (1000 - 11p)/13
For n to be an integer, 1000 - 11p should be divisible by 13.
So we can do p=1,2,3... until we find the first number divisible by 13.
But wait, isn't it easier to check divisibility by 11?
Right?
So let's do the other way round.
p = (1000 - 13n)/11
Now put n = 1, Numerator is 987 which is not divisible by 11 since sum of odd digits - sum of even digits is not divisible by 11.
Keep doing it and you will get the first success at n = 5 when numerator becomes 935.
So Rs. 935 on pens and Rs. 65 on notebooks.
So Rs. 65 is the minimum I can spend on notebooks.
From here, if I want to spend Rs. X more on notebooks then I will have to spend Rs. X on pens.
So X has to be a multiple of 11,13. In fact, it has to be the LCM. Which is 143.
So keep subtracting 143 from 935 as long as it doesn't become negative.
143*6 = 858
So you can subtract 6 times.
Hence total solutions = 7.
Here is another solution based on modulo arithmetic.
Comments
Post a Comment