# Number of ways of selecting 4 numbers.

Number of ways of selecting 4 numbers from the set of first 20 Natural numbers, such that they are in A.P.

Umm, I did try solving it but couldn't come up with something concrete. I really don't want to evaluate each case separately, that'd be really cumbersome and not-so-smart way doing it, IMO.

-

To get an arithmetic progression, of the form $a,a+d,a+2d,a+3d$, we need to choose $a$ and $d$, where $d \neq 0$.

If $a=1$, we need $3d \leq 19 \implies d \leq 6$. Hence, there are $6$ options.

In general, for a fixed $a$, $d$ has $\left \lfloor\dfrac{20-a}3 \right \rfloor$ options. Now sum up over all options to get the answer.

Hence, the number of ways is $$\sum_{a=1}^{17} \left \lfloor\dfrac{20-a}3 \right \rfloor = 57$$If you allow $d$ to be zero as well i.e. if you consider $a,a,a,a$ to be an arithmetic progression as well, then $$\sum_{a=1}^{17} \left \lfloor\dfrac{20-a}3 \right\rfloor +20= 77$$

-

Hint: To pick four numbers in arithmetic progression, you really only need to pick the first and last number so that their difference is divisible by 3. That entirely determines the arithmetic sequence.

-