Let us consider a specific case of an extended Kakuro puzzle. Given an integer $n$, we must form $n$ as the sum of $k$ distinct positive integers each less than or equal to $r$. From a mathematical standpoint we know that any number including, and between $L=\frac{k(k+1)}{2}$ and $R=k(r+1)-L$ is achievable in such a way. Given a number $n$, which is between those limits, can anyone think of an algorithm to generate a set of $k$ integers which satisfy the above conditions(knowing that there is at least one such set)?  
Generating a distinct k-partition of n
algorithms;search problem;integer partitions