<s>[INST] How many Arithmetic Progressions having $3$ terms can be made from integers $1$ to $n$? How many Arithmetic Progressions having $3$ terms can be made from integers $1$ to $n$? The numbers in the AP must be distinct.
For example if $n=6$ then number of AP's possible are $6$ 


*

*$1,2,3$

*$2,3,4$

*$3,4,5$

*$4,5,6$

*$2,4,6$
 [/INST] Let the three term AP be $a,a+d,a+2d$ where $a,d$ are natural numbers.
So, $a\ge1$ and $a+2d\le n\implies 1\le a\le n-2d \implies d\le \frac{n-1}2$
If $d=1,a$ can assume $1,2,\cdots, n-2$ i.e., $n-2$ values.
If $d=2,a$ can assume $1,2,\cdots, n-4$ i.e., $n-4$ values.
If $n$ is even, $d_{max}=\frac{n-2}2$
for $d=\frac {n-2}2,1\le a\le 2$ i.e., $a$ has 2 values.
If $n$ is even, the number of AP is $(n-2)+(n-4)+\cdots+2=\frac{(n-2)}4(2+n-2)=\frac{n(n-2)}4$
If $n$ is odd, $d_{max}=\frac{n-1}2$
So, in that case the number of AP will be $1+3+\cdots+(n-4)+(n-2)=\frac{(n-1)^2}4$
</s>