I have always had trouble solving this kind of problem - forming numbers involving zero.
In how many ways can we form a 2-digit number using only 0 and 1
This one is fairly easy. The first one must be 1, thus the second one must be 0.
In how many ways can we form a 3-digit number using only 0, 1 and 2
- I choose the first digit in $2$ ways ($1$ or $2$)
- Then I have $2$ numbers remaining which I distribute in $2!$ ways: $4$ numbers in total
(...) 4-digit number using only 0, 1, 2 and 3
- First digit: $3$ ways
- Remaining digits: $3!$ ways, $18$ numbers in total
(...) $n\le9$ -digit number using only $0,1,...,n-1%$
- First digit: $(n-1)$ ways
- Remaining digits: $(n-1)!$ ways
- Total: $(n-1)(n-1)!$ numbers
Is it the right and the most appropriate way to do this or is there a different approach?
Apart from that, if the task were like this:
In how many ways can we form a 7-digit number using only 0,1,2
- First digit: $2$ ways
- Every other digit: $3$ ways
- Options where only 1 digit is used: $2$
- Options where only 2 digits are used: $2^7$ ways
- Total: $2\cdot3^6-2-2^7= 1328$
Could you please review this method?