Revision- 9

What is Arithmetic Progression

Arithmetic Progression, also known as arithmetic sequence, is a sequence of numbers in which the difference between consecutive terms remains constant. This constant difference is called the common difference (d). Each term in the sequence can be obtained by adding the common difference to the previous term. The general form of an arithmetic progression is: a, a + d, a + 2d, a + 3d, ..., where 'a' is the first term and 'd' is the common difference.

Nth Term in an AP

Nth term in an AP can be calculated using 

Code

Following code is the implementation of the latter approach:

Sum of n Terms in an AP

Sum of n  terms in an AP can be calculated using 

Code

Following code is the implementation of the latter approach:

What is Geometric Progression

Geometric Progression is a sequence of numbers in which the ratio between any two consecutive terms remains constant. This constant ratio is denoted by 'r' and defines the pattern and behavior of the progression. The terms in a geometric progression can be represented using the general formula: a_n = a_1 * (r^(n-1)), where 'a_n' represents the nth term, 'a_1' denotes the first term, 'n' represents the position of the term, and 'r' is the common ratio.

Nth Term in a GP

Nth term in an GP can be calculated using 

1.Formula : a_n = a_1 * (r^(n-1))

2.Keep on multiplying common ratio(r) to the first term

Code

Following code is the implementation of the latter approach:

Sum of n Terms in a GP

Sum of n  terms in an GP can be calculated using 

Code

Following code is the implementation of the latter approach: