How many numbers are there between 1 and 1000 with their sum of digits ≤ 5?
55
We need a number of the form ABC where A+B+C≤5, and A,B,C are whole numbers.
Method 1 - Trial and Error - Manual approach
List out all the possibilities manually,
Case 1: When sum of digits=1
A+B+C=1
We can solve this using the similar to different approach where there is 1 zero and 1 one. Number of combinations =3C2=3
Case 2: When sum of digits=2
A+B+C=2
Number of possibilities = Answer based on 2 zeroes and 2 ones =4C2=6
Case 3: When sum of digits=3
A+B+C=3
Number of possibilities = Answer based on 3 zeroes and 2 ones =5C2=10
Case 4: When sum of digits=4
A+B+C=4
Number of possibilities = Answer based on 4 zeroes and 2 ones =6C2=15
Case 5: When sum of digits=5
A+B+C=5
Number of possibilities = Answer based on 5 zeroes and 2 ones =7C2=21
Total = 21+15+10+6+3 = 55
Method 2- Shortcut
We will use a dummy variable "D” to take the place of the ≤ sign.
Then the equation becomes -
A+B+C+D=5 (Where D can take values 0,1,2,3,4,5)
A+B+CD504132231405
Using the same Similar to Different approach, we can get the answer based on 5 zeroes and 3 ones as 8C3=56
We must remove the case where D=5, because in that case A+B+C=0, which is not possible. Thus, the answer is 56-1=55.