This is a little different than the normal case of permutations with repetition. Basically, let's say we have $n$ numbered balls, and there are $n$ spots. However, we can leave a spot empty if we want. The solution I got was basically...
$ \sum_{i=0}^n {n \choose i} \frac{n!}{(n-i)!} $
The idea being that for a given number of blank spots, you can calculate the permutations in the remainder...and the combination gives you the distribution of those blank spots for a given number of blank spots. But I'm wondering if there is a way to collapse this sum?
Thanks!
Edit: here is the clarification that was asked for (sorry for the delay). The answer for case 2 would be 7. You have 2 spaces, and three numbers. 012. 1 and 2 can only appear once, but 0 can repeat. The posibilities are as follow:
00,01,02,12,21,10,20
Make sense? For 3 balls, you have to do it out but it turns out to be 34. It follows the equation I posted. I hpoe that helps.