I need find a recursive function ( Withdrawal formula ) $\operatorname{f}\left(n,k\right)$ for the problem:
- What is the number of ways to write $n$ as a sum of $k$ different nonnegative integers, including zero ?.
- examples for $n = 6,\ k = 3:\ 0 + 4 + 2,\ 1 + 5 + 0,\ 1 + 2 + 3$. $\mbox{So,}\ \operatorname{f}\left(6,3\right) = 3$. The answer should be without SIGMA ( summing ).
My attempt:
- I thought to look at the first number, but it doesnt help, because i canot guarantee it wont appears in $\operatorname{f}\left(n - i,k - 1\right)$.
- I thought maybe look at the problem as building a increasing monotonous series of
$$
\left\{0,\ldots,n\right\}\quad\mbox{of length}\quad K
$$
- But again dont know how to move from here.