Let $n,k,r$ be positive integers. Let $S(n,k,r)$ be the number of all solutions of the Diophantine Equation $x_1+x_2+\dots+x_k=n$ with $0\le x_i\le r$ for every $i\in \{1,2,\dots,k\}$?
How many of these solutions are distinct, that is, $x_i\ne x_j$ for $i\ne j$?
Let $T(n,k,r)$ be this number. Let $s\le k$. There are $\binom{k}{s}$ ways to select $s$ unknowns $x_i$. The number of solutions in which these $s$ unknowns are equal, seems to be $$\sum_{i=0}^{\lfloor \frac{n}{s}\rfloor}T(n-si,k-s,r)$$
So it seems:
$$T(n,k,r)=S(n,k,r)-\sum_{s=2}^n\sum_{i=0}^{\lfloor \frac{n}{s}\rfloor}\binom{k}{s}T(n-si,k-s,r).$$
Can we derive a formula for $T(n,k,r)$ from it?
It doesn't seem to be a good approach. Assuming $S(n,k,r)$ is known, is there a formula for $T(n,k,r)$?