Find the number of ways to put the 7 balls (Distinct) into the 3 boxes (Distinct) without any restrictions ?
I know that answer will be $3^7$ as I can write this as
$F : { 1,2,3,4,5,6,7 } -> { a,b,c } $
But, I want to know how Stirling formula of second kind solves this :-->
=> Number of ways to put all balls in 1 box + Number of ways to put all balls in 2 boxes + Number of ways to put all balls in 3 boxes
=> $1!.S(7,1) + 2!.S(7,2) + 3!.S(7,3)$
=> This gives 1933 but it should be $3^7$ = 2187
Where am I going wrong ?
The number of ways of getting exactly k different values when you throw n fair r-sided dice is
$\binom{r}{k}\cdot S_2(n,k)\cdot k! $
Thus for your problem, $\binom31\cdot 1 \cdot1! + \binom32 \cdot 63 \cdot 2! + \binom33\cdot 301\cdot3! = 2187$