[Math] How many natural numbers from 1 to 10000 there are (with 2 conditions)

discrete mathematics

How many natural numbers from 1 to 10000 there are (with 2 conditions)

CONDITION 1: They do not contain zero.

CONDITION 2: Sum of their digits is 9.

So, I went to count manually.

from 0-9 there is just one.

from 10-99 there are 4 * 2! = 8

from 100-999 there are: $D(3,6) = 28$

from 1000-9999 there are: well, here i got a little confused and angry. and decided to ask you guys, if there's a "trick" to find those numbers accurately and fast. because if it would be from 0 to 1 million, or even 10 million, so.. I'm kinda stuck.

Edit: I guess, from 1000-9999 there are $D(4,5) = 56$

So, $56+28+8+1 = 93$ numbers.

Best Answer

There are 93. This isn't a very well motivated answer, but it is true. The numbers are as follows.

9, 18, 27, 36, 45, 54, 63, 72, 81, 117, 126, 135, 144, 153, 162, 171, 216, 225, 234, 243, 252, 261, 315, 324, 333, 342, 351, 414, 423, 432, 441, 513, 522, 531, 612, 621, 711, 1116, 1125, 1134, 1143, 1152, 1161, 1215, 1224, 1233, 1242, 1251, 1314, 1323, 1332, 1341, 1413, 1422, 1431, 1512, 1521, 1611, 2115, 2124, 2133, 2142, 2151, 2214, 2223, 2232, 2241, 2313, 2322, 2331, 2412, 2421, 2511, 3114, 3123, 3132, 3141, 3213, 3222, 3231, 3312, 3321, 3411, 4113, 4122, 4131, 4212, 4221, 4311, 5112, 5121, 5211, 6111.