For every integer k such that 1 LE k LE 6 determine how many
For every integer k such that 1 LE k LE 6, determine how many natural numbers less that 10^6 have exactly k distinct digits in their expression in base 10 system.
Solution
for k = 1, only 1 distict digit numbers are
1 to 9 one digit - 9 numbers
2 digit numbers - also 9 numbers, 11,22....99
similarly for 3,4,5,6 digits
total numbers 9*6 = 54
for k = 2
we want exactly two distict numbers
for two digits
we have 9* 8 + 9*1(when second digit is zero) = 72 numbers
for three digits
when first two digits same
9*8 = 72
when last two digits same
9*8 + 9*1( when last two zero) = 81
when first third same
9*8 + 9*1(when second is zero) = 81
total = 234
Or what we can do is
calculate for 100-199 and multiply by 9 (due to symmetry)
for 4 digits calculate for 1000-1999 and multiply by 9
and so on
