### AP & GP

Arithmetic progression:
The numerical sequence, in which each next term beginning from the second is equal to the previous term, added with the constant for this sequence number  d, is called an arithmetic progression. The number d is called a common difference.
Any term of an arithmetic progression is calculated by the formula:

an =  a1 + d ( n – 1 ) , Where a1 is the first term.

A sum of  n first terms of arithmetic progression is calculated as:

$S_n=\frac{n}{2}( a_1 + a_n).$
$S_n=\frac{n}{2}[ 2a_1 + (n-1)d].$

where an is the nth term and n is the no of terms in sequence.

Geometric progression:
The numerical sequence, in which each next term beginning from the second is equal to the previous term, multiplied by the constant for this sequence number r, is called a geometric progression. The number r is called a common ratio. Any term of a geometric progression is calculated by the formula:

b=  a1  r n - 1
A sum of  n first terms of geometric progression is calculated as:

= , |r| >1
= , |r| <1