What are the number of ways of picking (with replacement) $k$ integers from a successive set of integers from $1,2 ... n$ so they add to value n?
For example, say the set is $\{1,2,3,4\}$ then $n=4$ and for $k=1,2 ... n$ we have: $$\{1,1,1,1\}$$ $$\{2,1,1\}$$ $$\{2,2\}$$ $$\{3,1\} $$ $$\{4\}$$
Is there some formula for this or does it require an algorithm? Please provide these. Thanks.