Four numbers are chosen from 1 to 20. If $1\leq k \leq 17$, in how many ways is the difference between the smallest and the largest number equal to k?
My Working:
Case 1:
The greatest number is 20.
As $1\leq k \leq 17$, hence, the smallest number $\geq 3$.
If it is 3, the number of ways of choosing the other 2 numbers is $16\cdot 15$
Similarly, for smallest number $4, 5, 6,\cdots$ no. of possibilities are $15\cdot 14$, $14\cdot 13$, $13\cdot 12$,$\cdots$
Hence, total combinations$=\sum{n(n+1)}$ from $n=16$ to $n=1$
Case 2:
The greatest number is 19 and 18. We can proceed similarly to get the same result i.e. total combinations$=\sum{n(n+1)}$ from $n=16$ to $n=1$
Case 3:
The greatest number $\leq 17$.
Let us call it $l$. total combinations$=\sum{n(n+1)}$ from $n=l-2$ to $n=1$
Problem:
This solution is very long. Is there an easier way of solving it?