Posted by **Sana** on Sunday, October 15, 2006 at 10:37am.

How many n-digit decimal sequences (using digits 0-9) are there with k 1s?

I'm not entirely sure what you question is asking, but I'll take a guess.

You have n digits and k 1's with k<n

There are n choose k ways to arrange the 1's in your number.

You now have n-k places to choose the other 9 numbers. There are two cases to consider: when the fist digit is 1 and when it isn't. If it's not 1 then there are only 8 digits you can use, since a number wouldn't have 0 in the lead position. If it is a 1 then there are 9 possible choices for each of the n-k position or 9^{n-k} * n choose k numbers. I'll let you finish it for the case when it's not a 1 in the first place, then add the two together for the total.

I see someone else posted this question too and they said leading 0's are acceptable, so you can disregard part of the previous post if you have the same quesiton as them.

There are n choose k ways to arrange the 1's and 9^{n-k} ways to select the other numbers, so

n choose k * 9^{n-k} total numbers here.