PTK
How many integers between 1 and 10^21 are such that the sum of their digits is 2?
A. 190
B. 210
C. 211
D. 230
E. 231
If the sum of the digits of an integer is 2, then either a digit is 2 and the rest of the digits are 0 OR two digits are 1 and the rest of the digits are 0.
Case 1: One digit is 2 and the rest of the digits are 0.
Since the first digit of an integer can’t be 0, 2 must be the first digit. So between 1 and 10^21, we have: 2, 20, 200, 2000, etc. Since 2 = 2 x 10^0, 20 = 2 x 10^1, 200 = 2 x 10^2, …, and the last one being 2 x 10^20, we have 21 such numbers.
Case 2: Two digits are 1 and the rest of the digits are 0.
Notice that 10^21 is 1 followed by 21 zeros, i.e., a 22-digit number. However, it’s the smallest 22-digit number. Therefore, any number we have can only have at most 21 digits. Also, though we’ve mentioned that the first digit of an integer can’t be 0, let’s for the moment assume that it can be. Now assume that we have a 21-digit number (or code) that consists of 2 ones and 19 zeros. The number of ways to arrange 2 ones and 19 zeros is 21!/(2! x 19!) = (21 x 20 x 19!)/(2 x 19!) = 210. So there are 210 such codes and all these 210 codes are actually the numbers from 1 to 10^21 that have two digits of 1 and the rest of the digits as 0 if we omit all the initial 0s before the first digit of 1 (for example, consider 000000000000000000101 as the number 101).
Therefore, in the two cases combined, we have a total of 21 + 210 = 231 such numbers.
Answer: E