singhsa wrote:How do we do these kind of problems?
How many integers between 1 and 1021 are such that the sum of their digits is 2?
OA - 231
We have the biggest possibility as a 4-digit integer 1010, so let's deal with the smallest possibility as 0002 only; and for 4-digit integers, 3 separations (say $$$) are required. Let's represent the sum of 2 by two asterisks **, and as we've allowed ourselves to take '0' into account in order to complete the four digit-locations, more than one separations can be put at a given digit-location.
With this, 0002 or 0011 may now be taken as $$$** or $$*$*, respectively. In other words, the question in chief is asking us to find all the permutations for the five locations like $$$** or $$*$*. It has got 2 items of one type and 3 of another type, total is 5, and the permutations are
= 5!/ (2! 3!)
= 10
We can count this on finger tips too
0002
0020
0200
0011
0101
0110
1001
1010
Since we cannot include 1100 and 2000, hence [spoiler]
8 only.
I don't know why and how it's 231.[/spoiler]