The number of integers between 1 and 1000000 that have the sum of the digits 18, is
Any number between 1 and 1000000 must be of less than seven digits. Therefore, it must be of the form a1 a2 a3 a4 a5 a6
where a1, a2, a3, a4, a5, a6 ∈ {0, 1, 2, …, 9}
According to question, sum of the digits = 18
Thus, a1 + a2 + a3 + a4 + a5 + a6 = 18
where 0 ≤ ai ≤ 9, i = 1, 2, 3, …, 9.
Required number
[leaving terms containing powers of x greater than 18]