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? 
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?
 A: I will assume that numbers may not be repeated and that order of selection of the numbers does not matter., i.e. we are counting how many subsets, $A$, of $\{1,2,\dots,20\}$ have the property that $max(A)-min(A)=k$
First, recognize that $max(A)-1\geq max(A)-min(A)=k$ implies $max(A)\geq k+1$, for example if the distance between max and min is six, you cannot have the largest number be $6$ or less, it must be at least $7$ or more.

Step 1: Pick the largest number.

We first need to count how many ways in which we may pick the largest number for our set for a specific $k$.  As $20\geq max(A)\geq k+1$ there are $20-k$ different possibilities for $max(A)$.
(E.g. for $k=19$ our only choice is for $max(A)=20$ and $min(A)=1$ for a total of $20-19=1$ choices while for $k=17$ we could have $max(A)=18~min(A)=1,~~max(A)=19~min(A)=2,$ or $max(A)=20~min(A)=3$ for a total of $20-17=3$ choices)
In having picked the largest number, the smallest number is forced to ensure that the desired difference is achieved.

Step 2: Pick the locations of the remaining two numbers in relation to the smallest number.

There will be $k-1$ available numbers between $min(A)$ and $max(A)$ to choose from and we wish to select two of these without regard to their order.  There are $\binom{k-1}{2}$ ways to accomplish this.
There are then $(20-k)\binom{k-1}{2}$ subsets of $\{1,2,\dots,20\}$ with the property that $max(A)-min(A)=k$
Note: for $k=1$ and $k=2$ the above formula correctly gives a total of zero possibilities without need to add a special case since $\binom{k-1}{2}=0$ in both of those cases.
